Tagged: TreeGrid State navigate refresh
September 2, 2020 at 6:47 am Unable to retain the user state in TreeGrid when navigate/refresh. #112910
We are using JQXTreeGrid table for showing data in Hierarchy model. For TreeGrid, we wanted to have parent/child lazyloading which is why I have enabled ‘Virtual Mode with Ajax’ feature. I expanded Tree to child level and navigated to different page in the same application, when i return back to the Grid page, we noticed the Tree is collapsed.
We expect the tree to maintain the previous state(means it should be expanded to child level same as before navigating to different page).
Is there any flag or API to restore the TreeGrid state between navigations?
Ramesh GuptaSeptember 3, 2020 at 8:58 am Unable to retain the user state in TreeGrid when navigate/refresh. #112952
HristoParticipantSeptember 4, 2020 at 6:29 am Unable to retain the user state in TreeGrid when navigate/refresh. #112977
Thanks for the Response.
In our application we are getting the data through REST API from backend.
In order to expand for child nodes, we use Ajax method to get child data.
Here we don’t have level restriction, we can have multi level child data/records.
assume we expanded certain level say 2 and 3 of parent1 and parent2 records/rows.
After navigating to page and come back to this JQXTreeGrid page we see only parent level rows only, but not the “previous state” of second level child from parent1 and third level child from parent2.
Please advice the way to retain the state.
Ramesh GuptaSeptember 4, 2020 at 10:46 am Unable to retain the user state in TreeGrid when navigate/refresh. #112980
Hello Ramesh Gupta,
You could bind to the
rowExpandevent and save the specific key for each one row in the array.
After that, when you return back to this page expand them again.
But I cannot figure out what causes the mentioned from you behavior.
Is there any error message in the console?
Also, it will be better if you could provide us with a source code that demonstrates the mentioned case.
https://www.jqwidgets.comSeptember 4, 2020 at 4:50 pm Unable to retain the user state in TreeGrid when navigate/refresh. #112990
We tried in similar way earlier with older version, it didn’t worked as expected, we’ll try in latest version
Ramesh GuptaSeptember 10, 2020 at 6:27 am Unable to retain the user state in TreeGrid when navigate/refresh. #113050
We tried in the way you suggested, but we are not reaching our need.
Since we use ‘virtualModeCreateRecords’ function implementation, ‘expandRow’ making REST call each time, in our case it will make multiple calls. Which is not required our backend call serves 9 records for “restore” case.
The exact use case what we need to achieve is as below.
Child1 of child1
Child2 of child1
Child1 of child2
Child2 of child2
Suppose we have expanded TreeGrid like above and navigated to other page, and came back to TreeGrid page, then at first only we need to show in the above expanded way.
Response we receive from backend is all 9 records in one call. Only thing we need to do is arrange them in hierarchy order as shown above.
In order to do that, is there any way of marking the children and sub-children using level or any other parameter?
Please suggest to build TreeGrid in hierarchy passion.
Ramesh GuptaSeptember 11, 2020 at 11:46 am Unable to retain the user state in TreeGrid when navigate/refresh. #113060
Hi Ramesh Gupta,
In virtual mode, you always start from root level and sub-levels are only loaded on demand i.e. until sub records are loaded on demand, these records are leaf records. My colleague correctly suggested you to use ‘rowExpand’ and to expand again on restore. You will need to make sure to expand again the stored records, only after the data is loaded in the TreeGrid.
You must be logged in to reply to this topic.