Ok so this works for most cases, but I have a situation where in some rows some cells are editable, but not others. Screenshot attached(white cells are not editable, yellow and dark blue rows are not editable). There is no direct property of the ui object when the editable check is called that has the column index, but there is the ui.rowData["pq_cellselect"] which gets the dataIndx of the currently selected column. Unfortunately this property appears to only be available when a cell is clicked, if a user uses keyboard navigation this property is undefined. So as a workaround I am storing the last known selected column, but of course this only works if the user uses the up/down keys to navigate. Using tab, enter, or right key prevent this from working properly.
obj.editable = function (ui) {
var rowIndx = ui.rowIndx;
var colIndx = getNameOfFirstObjectProperty(ui.rowData["pq_cellselect"]);
if (!colIndx)
colIndx = grid.LastSelectedDataIndx;
else
grid.LastSelectedDataIndx = colIndx;
if (!$(this).pqGrid("hasClass", { rowIndx: rowIndx, dataIndx: colIndx, cls: 'gridCellDisabled' }) && $(this).pqGrid("hasClass", { rowIndx: rowIndx, cls: 'gridRowEditable' }))
return true;
else
return false;
};
How can I resolve this?