Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Yan on Mar 25, 2008 13:11
open dhtmlx forum
Cell focusing 2

I get an error when I call grid.selectCell(rIn, cIn, false, false, true) on stage == 2

I created a function that is onCellValueChanged where

if(stage == 0)
    return true;
else if(stage == 1)
    
else if(stage == 2) {
    I want to validate the cell val and keep focusing on it ifI the cell value is not right
}
Is there a simple way to do it?

Thanks

Yan
Answer posted by Support on Mar 26, 2008 04:21
There is no way to prevent closing editor from onEditCell event , but it possible to reopen it if value is not valid
mygrid.attachEvent("onEditCell",function(stage,id,ind,value){
    if(stage == 2) {
        if (some_check(value))
            window.setTimeout(function(){
                mygrid.selectCell(mygrid.getRowIndex(id),ind,false,false,true);
            },1);  
    }
    return true;
});