We have a grid implementation where we open a sub row ajax when a drop down in the row is selected, now the users can open multiple such sub rows in the grid, and perform an update operation on any of these rows.
When a update is performed, a ajax call is made to the server which will update some data relating to the row on the server and a xml response containing the updated information is sent back, this response contains the grid xml with updated row data, the xml is of the format that is defined by DhtmlxGrid, i.e., it contains head node with column definitions and other data that is expected by the gird and it also contains the row that has got updated.
we use the following apis, which should update the row in the grid,
grid._refresh_mode=[true,true,false];
grid.parse(response_xml); //response_xml is the xml that we get from the ajax request.
The trouble is that, we see the gird is getting reinitialized which causes any open sub row ajax cells in other rows that have not been updated to close.
Is there a way to update the grid that retain the state of the rows that have not got updated?
You must not return “head” section for such update calls.
“head” section forces reinitialization of grid, the same code used against pure data xml will work correctly.
Thanks for responding.
We tried your suggestion, it does not work, we removed the head section from the xml, but we are sending the userdata node under the rows node. Is sending userdata node is causing this problem?
We just noticed a bug in refreshing rows, the xml response that we get also contains a cell with option values as follows.
abc
the above is meant for a combobox that we display in the row, the above value which we have recieived in the ajax response don’t get updated in the row.
We tried your suggestion and it does not appear to work. The following is the code,
//elm is the row element in the response xml
var optionsList = elm.getElementsByTagName('option');
var optionsXmlString = "<complete>";
for(var optionsCounter = 0, numberOfOptions = optionsList.length; optionsCounter < numberOfOptions ; optionsCounter++) {
var option = optionsList[optionsCounter];
optionsXmlString += option.xml;
}
optionsXmlString += "</complete>";
//the above creates a string which looks something like this
//<complete><option selected="1" value="">Select Option...</option><option value="123">abc</option><option value="456">efg</option></complete>
//code suggested by you
var combo=selectedGrid.getColumnCombo(12);
combo.clearAll(true);
combo.loadXMLString(optionsXmlString);
please let me know if there is anything else you need to solve this issue.