Hello,
I have a grid which is synced with a datastore. I’d like this grid to be editable.
var ds = new dhtmlXDataStore({ url: URL1, datatype: 'xml' });
...
// just to make grid editable (grid is synced with ds)
var dp = new dataProcessor(URL2);
dp.init(ds);
...
var grid = layout.cells('a').attachGrid();
...
grid.init();
grid.sync(ds);
For add operation I use a simple form and dhtmlxAjax request. If a response indicates that a record has been successfully added to the database, datastore add() functions is called.
dhtmlxAjax.post(URL3, 'jsondata='+JSON.stringify(data), function(loader) {
var tokens = loader.xmlDoc.responseText.split(':');
if (tokens[0] == 'true') {
data.id = tokens[1];
ds.add(data);
dhtmlx.message({type:'alert', text:tokens[2]});
} else {
dhtmlx.message({type:'alert-error', text:tokens[2]});
}
});
As soon as a record is added to the datastore, new request to URL2 is triggered. As a dataProcessor is bound to the datastore, it’s most likely expected, however I have 2 HTTP requests for a single add operation. Is there any way to avoid these duplicates?
Thanks in advance,
George