Next
Update
Prev
View Selected Rows (Index)

The CheckBoxes of specific rows can be selected when the Grid is loaded by using the KoolGrid API, setSelectedIndices(). This example demonstrates that the 2nd, 4th and 5th rows are selected when the Grid is loaded.

...
<DataGrid ... selectionMode="multipleRows" ... >
...

function gridReadyHandler(id) {
  gridApp = document.getElementById(id);
  gridRoot = gridApp.getRoot();

  gridApp.setLayout(layoutStr);
  gridApp.setData(gridData);

  function dataComplete(){
    dataGrid = gridRoot.getDataGrid();
    selectorColumn = gridRoot.getObjectById("selector");
    selectorColumn.setSelectedIndices([1,3,4]);
  }
  
  gridRoot.addEventListener("dataComplete", dataComplete);
}

function getSelectedIndices() {
  var selectorColumn = gridRoot.getObjectById("selector");
  selectorColumn.setAllItemSelected(!selectorColumn.getAllItemSelected());
}

© 2017 KoolChart. All rights reserved.