Next
Update
Prev
View Selected Rows (Index)

You can create a custom event handler to capture the mouse click on the CheckBox (or Radio Button). This example demonstrates that the alert message pops up when the user click on the CheckBox.

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

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

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

  var selectorColumnChangeHandler = function(event) {
    var rowIndex = event.rowIndex;
    var columnIndex = event.columnIndex;
    if (rowIndex >= 0)
      alert("rowIndex:"+rowIndex+" selectedIndices:"+selectorColumn.getSelectedIndices());
    else
      alert("rowIndex:"+rowIndex+" allItemSelected:"+selectorColumn.getAllItemSelected());
  }
	
  var layoutCompleteHandler = function(event) {
    dataGrid = gridRoot.getDataGrid();
    selectorColumn = gridRoot.getObjectById("selector");
    selectorColumn.addEventListener("change", selectorColumnChangeHandler);
  }
  
  gridRoot.addEventListener("layoutComplete", layoutCompleteHandler);
}

function getSelectedIndex() {
  var selectorColumn = gridRoot.getObjectById("selector");
  if ( selectorColumn.getSelectedIndex() == -1)
    return alert("No rows selected.");
    
  alert(selectorColumn.getSelectedIndex());
}

© 2017 KoolChart. All rights reserved.