Search
GridColumn.sortable Property
See Also
 






Gets or sets a value indicating whether this column can be sorted.

Namespace: MindFusion.DataViews
File: GridColumn.js

 Syntax

JavaScript  Copy Code

get sortable() {}

 Property Value

Boolean. True if the column can be sorted, otherwise false.

 Example

The following code creates a new Grid instance with 3 GridColumn-s on which it sets various properties including sortable:

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