Jstree Status Plugin Does Not Save Tree State

Adding a state plugin to Jstree still does not save the state of the tree between page refresh or after clicking a link and returning to the previous page

$('#myGrid').jstree({ "types": { "key": { "icon": "Content/Images/skey.png" }, "value": { "icon": "Content/Images/sValue.png" } }, "state": { "key": "myTree" }, "search": { }, "core": { "check_callback":true, "data": [@Html.Raw(Model.JsonData)] }, "plugins": ["state", "types", "search"] 

Thank you,

+8
jquery state jstree
source share
2 answers

use set state property from documentation ...

0
source share

This works well for me in the current version 3.08. Although I use ajax to get json data through the controller (asp.net mvc or web api) based on id, and not to get raw html on load. I would recommend this if possible, it is cleaner and supports lazy loading. In my setup, jstree opens one node after another until it reaches the last node I opened.

This is not so good, but if I open several branches of nodes.

The important thing is that your nodes have unique id properties. Check also localStorage and see what is stored there.

0
source share

All Articles