Problem when updating rows in the gird from a ajax response.

Hi,

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?

Thanks,
Nadeem

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.

Hi,

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?

Thanks,
Nadeem

Yep, there is one more modification required
Try to locate and comment the next line in dhtmlxgrid_excell_sub_row.js

that.attachEvent("onXLE",function(){ this._collapsMonolite(); });

This Worked Thanks!

Hi,

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.

Thanks,

Which column type is defined in grid for that cell?

Hi,

The column type is defined a “combo_v”

Thanks

Hi,
We tried this with “combo” too and it fails with same behaviour

thanks

You should update combo options separately with following code:

var combo=mygrid.getColumnCombo(column_index); combo.clearAll(true); combo.loadXML(combo_url);

Hi Thanks for replying,

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.

Thanks,
Nadeem

Hi,

Could you kindly suggest a solution to this problem, we have bought a support license for dhtmlx, and opened a ticket with ticket id, JPF-219927.