Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen on Apr 04, 2008 12:12
open dhtmlx forum
Getting dataProcessorto respond to Undo/Redo

I have a grid which loads dynamically through a PHP script. I also have the dataProcessor set up to do updates (and soon adds/deletes) to the server.

What I need now is to find out how to get the .doUndo and .doRedo functions to fire off updates to the server as well. Right now you can go in and edit a field and hit Undo, but if you refresh the grid the change is still there.

Any ideas?
Answer posted by Support on Apr 07, 2008 05:22
There is no built in support of such functionality , but code can be easily updated in necessary way.

dhtmlxgrid_undo.js

dhtmlXGridObject.prototype.doUndo = function()
{
        ...
        c.setValue(obj.old_value);
        this.callEvent("onEditCell",[2, obj.row_id, obj.cell_index]);  //this line need to be added
}


added line will generate onEditCell event while undo call, which will trigger dataprocessor in default way.
Answer posted by Stephen on Apr 07, 2008 06:44
I assume that you'd add the same line of code to doRedo at the very end to accomplish the same result with Redo's, correct?
Answer posted by Support on Apr 07, 2008 07:52
>>I assume that you'd add the same line of code to doRedo at the very end to accomplish the same result with Redo's, correct?
yes, it can be done in same way for redo functionality.