|
<< Click to Display Table of Contents >> Manual > Control Reference > Basics > Grid control > Function Description > Setting Grid Properties > Setting Column/Row Properties |
How to specify column/row properties
Column/Row Properties allows you to easily set column widths, data types, row heights, etc. all at once.
In addition, the column/row properties have properties for setting whether or not to include them in the search for the filter function (search filter, field filter, sort filter) (EnableSearchFilter / EnableFieldFilter / EnableSortFilter. When using the filter function, be sure to set these properties as necessary.
To set column/row properties for each column (or row), use the following methods:
Set the column properties. |
|
Set the row properties. |
Below is an example of a script that sets the column/row properties.
this.Rows = 3;
this.Cols = 5;
// Set column width and data type
this.SetColProperty( 0,"Width",c(160, 100, 100, 60, 120));
this.SetColProperty( 0,"DataType",c("datetime", "string", "string", "number" ,"string"));
// Set data
this.SetRowData(-1, c("datetime", "data1", "data2", "data3", "data4"), F);
this.SetTableData(
c(
c( "2019/5/22 10:35:20", "2019/5/22 11:23:20", "2019/5/22 13:50:14"),
c( "data1_1", "data1_2", "data1_3"),
c( "data2_1", "data2_2", "data2_3"),
c( 123, 456, 789),
c( "data3_1", "data3_2", "data3_3")
),
0,
0,
F
);
■Explanation
1) |
Specify the number of grids to display (number of rows and columns) this.Rows = 3; this.Cols = 5;
|
2) |
Set cell properties
this.SetColProperty( 0,"Width",c(160, 100, 100, 60, 120));
this.SetColProperty( 0,"DataType",c("datetime", "string", "string", "number" ,"string"));
|
3) |
Set data for the header and each cell
this.SetRowData(-1, c("datetime", "data1", "data2", "data3", "data4"), F);
this.SetTableData(
c(
c( "2019/5/22 10:35:20", "2019/5/22 11:23:20", "2019/5/22 13:50:14"),
c( "data1_1", "data1_2", "data1_3"),
c( "data2_1", "data2_2", "data2_3"),
c( 123, 456, 789),
c( "data3_1", "data3_2", "data3_3")
),
0,
0,
F
);
|
|
In the above example, the column width is changed by specifying the column property "Width" of the SetColProperty method, but the same result can be achieved by writing this process as follows using the SetColWidth method.
this.SetColWidth( 0, c(160, 100, 100, 60, 120));
|