Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Larry Hamlet on Apr 12, 2009 21:08
open dhtmlx forum
Want To Send All Updated/Selected Rows Using DataProcessor.serverProcessor

I have a static Grid that is used to catch and modify Drag and Drop data at the User level.

Everything works perfectly until the User drags (inside the same Grid) to correct a row that was already insert/updated. Then nothing seems to get the DataProcessor.serverProcessor to send the now updated and "selected" row up to Php. The $_POST['id'] only contains rows that have never been touched before.

I use the basic setup...
oGrid1DataProcessor.serverProcessor=sendParameters;
sendDataRows = oGrid1DataProcessor.updatedRows; // Needed To Count The Rows
oGrid1DataProcessor.sendData();
If I poll oGrid1DataProcessor.updatedRows ALL the correct rows are displayed.

I have tried
oGrid1DataProcessor.setUpdated(2,true); and
oGrid1.cells(12,7).cell.wasChanged=true;

Interestingly I have also tried
oGrid1.submitOnlySelected(true); and oGrid1.submitOnlyRowID(true);
but these error out saying "Object doesn't support this property or method".

How can I get ALL the id's that are marked "Selected" to go up to Php no matter what?
Answer posted by Support on Apr 13, 2009 02:23
>>oGrid1.submitOnlySelected(true); and oGrid1.submitOnlyRowID(true); 
This is part of form integration extension, which requires additional js file to be included ( dhtmlxgrid_form.js ) and not related to dataprocessor.

Based on used settings ( second parameter of setUpdateMode ), dataprocessor will count d-n-d operation as combination of insert and delete or as single update operation. In both cases moved row will have changed status and will be sent to the server with next update. 
Beware that grid has inner response checking system, so if you have row updated - data sent to the server, now until client side will not receive a response with the same ID, not any new command for row in question will be sent. Client side will wait response with the same "sid" value and only after that allow data sending for the same row. 
Answer posted by Larry Hamlet on Apr 13, 2009 08:57

Here's an example.  Perhaps you can point out what's missing or in error.

Larry


Attachments (1)
FMFF2.zip4.48 Kb
Answer posted by Support on Apr 14, 2009 01:55
The code which you currently using in Check_POST_ids.php is just a test plug, right?
To work correctly, dataprocessor need to receive correct response from server side, for example in case of 3 updated rows, valid response will be similar to next

<?php //Check_POST_ids.php
  header("Content-type:text/xml");
  echo "<?xml version='1.0' ?>";
  echo "<data>";
  echo "<action type='updated' sid='1' tid='1' />";
  echo "<action type='updated' sid='2' tid='2' />";
  echo "<action type='updated' sid='3' tid='3' />";
  echo "</data>";
?>

Of course, in real life code will execute update instruction for each incoming rows and print related action tag in response, such direct outputing is just for test purpose. 
After applying correct response your test case starts work correctly - after pressing save first time , all 3 rows marked as saved ( bold text style removed ) , and if any of such rows will be moved again - it will be included in data sending. 



Answer posted by Larry Hamlet on Apr 14, 2009 08:32

Yes the Check_POST_ids.php is just a test plug.  And I do make an XML response <data>blah</data> in my code to alert the User to real activity.

I re-added the "<action type='updated' sid='blah'/>"; and it works.

But isn't there any way to work around the seemingly required xml echo "<action type='updated' sid='blah' tid='blah' />";.  Shouldn't we be able to affect the Gird "sendData" behavior in real time without sending XML?  

Larry

Answer posted by Support on Apr 15, 2009 01:57
In case of dhtmlxGrid ( it a bit more complex for tree and treegrid ) , you can use next code on client side to inform row that its operation finished ( so it will not require response from the server ) 
           dp.afterUpdateCallback(sid,tid,action,{}); 

where 
 dp - dataprocessor instance
 sid,tid,action - same values as in XML

command will trigger the same logic as XML response. 

If you need just remove block from sending rows with "not confirmed operation yet", you can use 
                  delete dp._in_progress[sid];

Answer posted by Larry Hamlet on Apr 15, 2009 06:02

Very Cool!  Thanks so much!  I really appreciate that.  --  Larry