Categories | Question details Back To List | ||
Usage of editCell() in the dhtmlXgrid Hi, I perform a set of validations on edit of a cell based on the new value entered. If the validations fail, then I will ask the user to re-enter the value and switch the cell back to edit mode so that the user can re-enter the value without selecting the cell again for editing. I have done this in the following way: "onEditCell" grid event: if(index == 4) { // perform some validations on the new value value specified in the cell. if(result != 0) // validation failed { mygrid.selectCell(mygrid.getRowIndex(id),4,true,true,true,true); mygrid.editCell(); alert('test'); return false; } } But after the alert message, the cell is being switched back to normal mode without retaining the edit mode. Could you please help me out fixing this. Thank you, Madhu Answer posted by support on Dec 29, 2008 08:30 Try putting selectCEll and editCell calls after alert, or even better check validation result on edit stage 2 (after editing) and switch cell to editing there if validation fault. Answer posted by Support on Dec 29, 2008 16:17 Structure of grid doesn't allow edit operation blocking, so working code need to use timeout and may look as grid.attachEvent("onEditCell",function(stage,id,ind,value){ if (stage ==2 && some_check(value) ) window.setTimeout(function(){ mygrid.selectCell(mygrid.getRowIndex(id),ind); mygrid.editCell(); },1); return true; }) |