:: Documentation >> Tutorial >> Grid >>

Controlling data selection.

Grid has built-in selection model, which supports single and multiple rows selection mode. You can specify if multiple selection is allowed in 'selection/multiple' property:

obj.setProperty("selection/multiple", true);

The index of the last selected row is stored in 'selection/index' property:

var index = obj.getProperty("selection/index");

While 'selection/values' property returns an array of all selected rows:

var array = obj.getProperty("selection/values");

Grid calls 'selectionChanged' action so you can attach an action handler to process selection event.

obj.setAction("selectionChanged", myFunction);

Multiple selection is activated if the Ctrl key is pressed during mouse clicks.