Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Janice on Mar 13, 2008 05:37
open dhtmlx forum
dataprocessor to send cell value to server upon xml load

Hi

I'm using dataProcessor where I have

    mygrid.loadXML("php/get.xml");
    myDataProcessor = new dataProcessor("php/update.php");

get.xml has absolute math formula in it

<row id="6">
<cell>=[[1,1]]-[[4,1]]</cell>
</row>

which means the grid displays the resulted value. I'd like to send the value of this cell to database just after the xml loads.

When I use dataprocessor to update cell [[1,1]] and send it to database, the new value of the cell above [[6,1]] should also be sent to database (even if the formula inside doesn't change).

I understand I should use the setUpdated and sendData functions where all rows should be sent,whether they are updated or not but it doesn't work. Maybe I'm missing something. I'm not adding a new row with dataprocessor but loading it from the xml file.

    myDataProcessor.dataprocessor.setUpdated(id,true,true); \\ the second 'true' is for force update
    myDataProcessor.dataprocessor.sendData();

Please help
Answer posted by Support on Mar 13, 2008 07:43
The problem can be caused by timing of commands, the loadXML is async, so you need to catch moment when data really loaded in grid.
Something similar to next

    myDataProcessor = new dataProcessor("php/update.php");
    myDataProcessor.init(mygrid);

    mygrid.loadXML("php/get.xml",function(){
        // this code will be executed only after data loading
        myDataProcessor.dataprocessor.setUpdated(6,true,true);
        // myDataProcessor.dataprocessor.sendData();  <= not necessary because of forceUpdate flag in previous command
    });