I set the validation property for each column in the datagrid. Now I want that when the current cell data fails validation, other cells cannot enter the edit by clicking.
I did this with the following code:
var editcell;
$('#dg').edatagrid({
//........
onBeforeCellEdit:function(index,field){
if(editcell != undefined){
$(this).datagrid('editCell',editcell);
return false
}
},
onCellEdit:function(index,field){
editcell = $(this).datagrid('cell');
},
onEndEdit:function(index,row){
editcell = undefined;
}
}).edatagrid('disableEditing').datagrid('enableCellSelecting').datagrid('enableCellEditing')
This seems to have achieved the goal. However, when the first column of cells fails validation, although the data returned to it has already met the requirements, I can find it difficult to click and edit other cells. Please help me improve the code, thank you!