Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Michael on Oct 05, 2009 14:29
open dhtmlx forum
data processor posting twice

Hello,

I have a dataprocessor for a grid. I recently switch from
oDPGrid.setUpdateMode("off");
oDPGrid.setTransactionMode("POST", true);

to this:

oDPGrid.setUpdateMode("cell");
oDPGrid.setTransactionMode("POST", false);

But now for some reason, the update is sent "TWICE" to the server. Why is it sending the update 2 times?
Answer posted by Stanislav (support) on Oct 06, 2009 01:31
In "cell" mode, update will be sent after value of any cell was changed. So if you edit two cells in the same row - the update will be sent for each edit operation. 
If you have double sending after editing a single cell - please try to include dhtmlxdataprocessor_debug.js in addition to existing files - it will show exact chain of events, which causing data sending. If it still not clear - please provide content of debug console ( generated by _debug.js ) for incorrect scenario.
Answer posted by Michael on Oct 06, 2009 06:38
Double post does not happen on update only on delete.  Attached is debug.
Attachments (1)
debug.zip901.00 B
Answer posted by Stanislav (support) on Oct 08, 2009 07:23
The content of log is pretty weird , it seems that client side code sends data twice without any logical reason. 
Which version of dataprocessor you are using?

Please try to update existing js files to the attached ones ( backward compatible ) 
Also, by any chance, are you have direct calls for dp.sendData or dp.setUpdated in your code?
Attachments (1)
codebase.zip14.19 Kb
Answer posted by Michael on Oct 08, 2009 07:32

Ok, I will try to update the file with the one you sent. 

And yes, I do have direct calls to dp.sendData().  If you notice in the debug file I sent, I provide a link in the last column to "delete" each row.  The "delete" link calls javascript which does the following:

oGrid.deleteRow(rowId);http://dhtmlx.com/docs/products/kb/imgs/_button_post_answer.gif">
oDPGrid.sendData(rowId);    

Does this cause a problem? 

Answer posted by Support on Oct 08, 2009 08:13
>>oGrid.deleteRow(rowId);
>>oDPGrid.sendData(rowId);  
>>Does this cause a problem? 

Yes. When using "cell" update mode, the grid will send data request automatically after any data changing operation. So, when deleteRow executed grid sends data to the server , and after that you are initiating second data sending by oDPGrid.sendData
To resolve issue just remove sendData command or change dataprocessor to different update mode. 
Answer posted by Michael on Oct 08, 2009 08:20
Thank you! That fixed it!