Gets or sets the display text of the column.
Namespace: MindFusion.DataViews
File: GridColumn.js
Syntax
JavaScript
Copy Code
|
---|
get caption() {}
|
Property Value
String. The display text.
Example
The following code creates a new Grid instance with 3 GridColumn-s on which it sets various properties including caption:
JavaScript
Copy Code
|
---|
var dv = MindFusion.DataViews; var column1 = new dv.GridColumn("index"); column1.dataType = dv.IntegerType; column1.editable = false; column1.caption = "#"; column1.sortable = false; columns.push(column1); var column2 = new dv.GridColumn("name"); column2.dataType = dv.StringType; column2.caption = "Name"; columns.push(column2); var column3 = new dv.GridColumn("state"); column3.dataType = dv.LookupType; column3.caption = "State"; column3.metaData.set("values", states.map(s => [s["Name"]])); columns.push(column3); var columns = [column1, column2, column3]; // create the grid control var grid = new dv.Grid(document.getElementById("grid")); grid.theme = "business"; // disable inplace editing grid.allowEdit = false; // do not show "New row" option in context menu grid.allowAppend = false; // do not show "Delete Row" option in context menu grid.allowDelete = false; // disable single cell selection grid.allowCellSelect = false; // set the model grid.model = new dv.ArrayModel(participants, columns); //the first column is sorted grit.sortedColumn = 0; |
See Also