Prevent User From Entering a Cell

Hello, is there a way to prevent a user from entering a cell? I tried the following:

_gridWDC.attachEvent(“onRowSelect”, cellSelected);

function cellSelected(rowId, colId) {
if (_grid.cells(rowId, colId).getAttribute(“notallowed”) != null) {//cell is not enterable
_gridWDC.selectCell(_previousRow, _previousColumn);//send the focus back to the previous cell
return false;

This works but it allows the user to enter the cell first, then quickly jumps back to the previous cell. I tried the onBeforeSelect event, but it only lets me know what the new row is, not the new column. If I knew the exact location of the new cell before entry, I could use that and the UI wouldn’t be jumping around.


Please, try to use the onEditCell event. … oneditcell

For example:

grid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){ if (stage==0){ //cell edition initiated return false; // block the edition } });

Thanks sematik, but I think you misunderstood. I’m not asking to prevent the user from editing a cell, I’m asking to prevent the user from entering the cell.


I apologize.
Please, try to use onBeforeSelect event: … foreselect

As I indiciated in my intial post, I tried the onBeforeSelect but it only returns the row and previous row, not the column of the new cell. I need to know this because I will be denying entry based on cell, not on the row. Some cells in a row may be enterable.

Is there a way to get onBeforeSelect to return the columns as well? That would solve my problem.

Please, open ticket at so we can provide you a custom version of dhtmlxgrid.js with the additional parameter in onBeforeSelect event (column index).