Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by jason on Jan 27, 2008 19:05
open dhtmlx forum
How to set value in selected cell

Hi Sir,

I use method doOnCellEdit when cell was edited
    function doOnCellEdit(stage, rowId, cellInd) {
        if (stage==0) { alert(0); }
        else if (stage==1) { alert(1); }
        else if (stage==2) {
            alert(mygrid.cells(mygrid.getSelectedId(), mygrid.getSelectedCellIndex()).getValue());
        }
    }
When cell's value was changed (stage==2) , any way to set new value to cells?
Thanks a lot
Answer posted by Support on Jan 28, 2008 07:18
If you need value for any other cell in grid just use
    grid.cell(i,j).setValue(new_one)

If you need to set value which have been edited, just return new value from onEditCell handler

function doOnCellEdit(stage, rowId, cellInd) {
        if (stage==0) { alert(0); }
        else if (stage==1) { alert(1); }
        else if (stage==2) {
            alert(mygrid.cells(mygrid.getSelectedId(), mygrid.getSelectedCellIndex()).getValue());
            return "some new value"; //will be set as new value of edited cell
        }
    }