dHTMLXgrid on JQuery 1.10.2 $.ajax

Hi all! Your controls look cool and are easy to learn to use them.

I’m integrating the dHTMLXgrid 3.6 (GPL) in a webpage controlled by jQuery (lib updated, was v1.9) for a POC (proof of concept).

Everything is going smoothly except submit altered data. I’m not adding or deleting rows. Just changing the text or selecting another value from a combo box.
I want to be able to submit the changed rows but with jQuery e not dHTMLXdataProcessor.
There for, and after a little search, I tryed something like:

    $.ajax({
        cache: false,
        type: "GET",
        url: "GridEditHandler.ashx",
        data: { Action: "SAVE_CHANGES",
            GridChanges: grid.getChangedRows()
        }
    });

I was thinking that the “grid.getChangedRows()” was going to return a JSon or XML format data with only the changed rows. But it just gives an error.
Maybe it’s because I’m using the GPL ?
I didn’t want to have to quit using dHTMLx now because of this!
Is there a way for to make this work ?

Thanks in advance!

grid.getChangedRows is a pro functionality in fact

You can try to still include dhtmlxdataprocessor.js but after initing it, add the the next line

[code]dp.setAutoUpdate(false);
dp.attachEvent(“onBeforeDataSending”, function(id, state, data){
$.ajax({
cache: false,
type: “GET”,
url: “GridEditHandler.ashx”,
data: { Action: “SAVE_CHANGES”, GridChanges: data }
});

return false;
});[/code]

as result, dataprocessor will collect all changes, but it will not send anything to a server side.
Later, when you need to save data you can do it by calling

dp.sendData();

which will trigger above event and logic in it. 3rd parameter of event - json structure with all modifications in grid.

Hello!

Unfortunately, the ‘data’ at “GridChanges: data” is just refered to one of the rows.
With that said it is understandable that this method is potentially called as many times as there are rows on the table.

Imagine a grid with over 150.000 rows. If add a funcionallity to sweap to all the rows and change one single value of any column accordingly to some input, when I want to save the data with this method I could’ve had dozens of millions of calls of the same method for different row to the same grid.

Don’t take it the wrong way what I’m going to say but that’s plain bad programming!

Althow all this, what I did was use the concept of this method and client-side invoce locally the same method and build-up a JSON of the changes gathered.
Then I used the JSZip (Javascript ZIP - stuk.github.io/jszip/ ) library to compress the data and then jQuery.ajax call to send the data to the server.

BTW, is it possible to retrieve the datasource of the grid that was inputed in it?
If so, what the method\property\how ?

I would love to know your thoughts about it all !

Cumps