I want to be able to conditionally disable selection of a row based on another column on that row. For example, I don't want to allow the user to select a row if a certain column is null.
I know how to conditionally set row and column attributes on data bound so think it's probably here but not sure what's next
function dataBound(e) {
var rows = e.sender.tbody.children();
for (var j = 0; j < rows.length; j++) {
var row = $(rows[j]);
var dataItem = e.sender.dataItem(row);
// Disable the checkbox if the location isn't set
if (dataItem.get("Location") === "") {
row.css('background-color', '#FFFFCF');
// What goes here?
}
}
items = null;
}
I also tried to do this on the change event, which kind of work, but the selected IDs (selectedKeyNames) were still being set when the select all checkbox was clicked.
function onChange(e) {
var i = e.sender.select();
var grid = e.sender;
i.each(function (i, e) {
var dataItem = grid.dataItem(e);
if (dataItem.get("Location") !== "") {
$(e).removeClass("k-state-selected");
}
});
items = this.selectedKeyNames();
}