I want do save the ‘open-state’ of multiple rows so that after a refresh of the data in the treeGrid all expanded items remain expanded.
I am using the grid.saveOpenStates()-function which works, but only for one row at a time. If the user expands multiple rows, only one state is saved and expanded after reload (via grid.loadOpenStates).
Is there any way to implement this? I tried with some custom JavaScript-functions made by myself, but it caused some poor performance of the treeGrid…
Unfortunately the issue cannot be reproduced locally.
The following code saves all expanded/collapsed rows automatically:
mygrid.attachEvent("onOpenEnd", function(id,state){
mygrid.saveOpenStates()
});
If issue still occurs for you, pleas,e provide with any kind of sample of your code with the init of your grid.
That is exactly the way i have done it. But the grid only opens the row with the biggest id, don’t know if that is relevant. I can open row 4, row 9, row 2 and then refresh. Row 9 will then be opened after reload, every other row stays closed.
As the code to saveState is the same as you posted above, i will show you how I load the state:
grid.load(gridQString, [b]loadState[/b], "xml");
function loadState() {
grid.loadOpenStates();
}
Your code is correct.
Using the same, and it works well for me.
Please, make sure that your dhtmlxgrid_ssc.js was not modified. What version of dhtmlxgrid do you have?
If it’s possible, please open ticket at support.dhtmlx.com and provide with a complete demo/demo link, where the issue can be reproduced
Oh, one more, please, make sure that each row has a unique id!
Dynamic loading requires the callback for row expanding.
In case of loadOpenStates() method that callback cannot be used, so interrupting the first row opening (loading the data for it) it starts to open the second one, and so on.
Ok, at least I know what is causing the problem. I am gonna implement it the way I had it before using the cookie-functions of the grid and limit it to 3 opened rows.
Thank you for your help!
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan