RealGrid2 Guide
Column
Dynamically changing column properties{visible, editable}

Control column properties

setColumns() You use a grid by setting up columns, but sometimes you need to change the properties of the columns as needed.

In this case, you can get the information of the column using columnByName() or columnByField. You can check the values of the properties in the corresponding column information or change them directly.

Additionally, you can use getColumnProperty() used in RealGridJS to check the current property value of the column and change it with setColumnProperty().

Changeable column properties

Representative column properties that change during use include visible and editable.

Specifies whether to display the column on the screen

Let's specify whether to display the name column.

//Get the current visible property value of the name (KorNanme) column.
var visible = gridView.columnByName("KorName").visible
alert(visible);
 
//Do not display the name (KorName) column.
gridView.columnByName("KorName").visible = false;
 
//Display the name (KorName) column.
gridView.columnByName("KorName").visible = true;

Specifies whether the column can be edited

Let's specify whether the phone number column can be edited.

//Get the current editable property value of the Phone column.
var editable = gridView.columnByName("Phone").editable;
alert(editable);
 
//Disable editing of phone number column.
gridView.columnByName("Phone").editable = false;
 
//Set the previous phone number (Phone) column to be editable.
gridView.columnByName("Phone").editable = true;

Change the size of the column

Let’s change the size of the product number column.

//Get width
var width = gridView.layoutByColumn("ProductId").cellWidth;
 
//Increase the width of the column by 10
var width = gridView.layoutByColumn("ProductId").cellWidth;
gridView.layoutByColumn("ProductId").cellWidth = width +10;
 
//Decrease the width of the column by 10
var width = gridView.layoutByColumn("ProductId").cellWidth;
gridView.layoutByColumn("ProductId").cellWidth = width -10;