addobject.com - innovative javascript component resource

NlsTree Standard Javascript Tree Menu: Incremental Loading and Tree State   

Expand All Collapse All

NlsTree supports tree state using cookie. The selected and expanded nodes information are stored in cookie. Normally after tree rendered on browser, NlsTree will read the value from cookie and expand tree node depends on the information in cookie. In this case the tree expect all the nodes are already loaded and exist/rendered in browser.

The problem comes when the tree is incremental loaded. With incremental loading, only the first level of nodes will be initially loaded on the page as the remaining nodes are loaded upon user interation with tree. This means some of previously expanded nodes are not loaded and not exist/rendered in browser. Therefore additional code to load the previously expanded nodes is necessary. In this example, the page check the value of cookie sent to server and load all the expanded nodes in addition to the first level nodes.

To try this example, expand several nodes in the tree then refresh/reload the browser.
To reset to original state, click here to delete cookies and refresh/reload the browser.

Copyright 2005-2006 www.addobject.com. All rights reserved.