Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by paul on Jul 29, 2008 06:36
open dhtmlx forum
doUndo() - cellID ???

Hello!

is there a way to get a rowId/cellInd of a cell on which the undo/redo operation is performed?
e.g. in order to change the styling of such cells.

thanks
Answer posted by Support on Jul 29, 2008 09:09
you can get necessary info as
    var obj = grid.getUndo().pop();
    //obj.row_id - id of  row
    //obj.cell_index - column index

For "redo" order, the same snippet can be used but with getRedo command
   
Answer posted on Jul 30, 2008 02:30
Thanks!

I found also helpful (and by the way more flexible) the following:
grid._UndoRedoData object
and
grid._UndoRedoPos property

one could access rowId/cellInd by checking

grid._UndoRedoData[grid._UndoRedoPos].row_id
and
grid._UndoRedoData[grid._UndoRedoPos].cell_index


by iterating through _UndoRedoData object one can find out, if the cell or row were edited somewhere else in the undo/redo histiory:

    for (i=0; i < undoPos; i++){
        if (grid._UndoRedoData[i].row_id == rowEdited && grid._UndoRedoData[i].cell_index == cellEdited )
            bCellWasAlsoEdited = true;
        if (grid._UndoRedoData[i].row_id == rowEdited)
            bRowWasAlsoEdited = true;
    }

I use this functionality to style the edited cells and rows (and to cancel special styling).
This helps users to see, which cells/rows she has changed in the original data list