vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.13k stars 1.38k forks source link

Reloading the page without reloading jstree #976

Closed arthurbau closed 9 years ago

arthurbau commented 9 years ago

Hello,

I am working on an application where the tree contains thousands of entries. The tree is built based on a Servelet which creates the Json_data. This process needs around 10 seconds to complete. The customer is aften refreshing the page which causes the tree to refresh and the servlet to be recalled. Is there any way to generate the json_data once and use it along the whole user_session. Please note that the json file is different from one user to another and cannot therefore be saved to some local file.

Best Regards Arthur

vakata commented 9 years ago

That is up to your solution, nothing jstree can do to help you. May I give a few op[tions: 1) On the server save each user's JSON once it is generated, so on a subsequent request you can skip the calculation 2) On the client - store the JSON in sessionStorage and on subsequent requests - if the entry in sessionStorage exists - use it instead of calling the server (which means skipping the calculation and the extra request). This can be achieved if you set core.data to a function. 3) Depending on your setup you can try lazy loading, but that may prove to be quite a bit of work.

Best regards, Ivan