Skip to content
Martin edited this page Aug 23, 2015 · 8 revisions

Vision

Trees should (optionally) maintain their status between page reloads. This feature should be provided by the jquery.fancytree.persist.js extension.

Status

The 'jquery.fancytree.persist.js' extension is already available (demo).

Yet there are still open questions, so this feature is open for discussion and the API is subject to change.

Please discuss here: https://github.com/mar10/fancytree/issues/11

Requirements

  • When a page is refreshed, or visited after a given time, the tree status should be maintained.
  • The tree state should be stored in cookies or session storage.
  • This feature should be optional and configurable.
  • Tree status is defined by
    • active node
    • focused node
    • expansion state
    • selection state

Diskussion

Resources

Problems

The feature is basically working, but currently there are some main issues and open questions:

  1. Events
    When node is re-activated, should the activate event be fired again?
    -> Rather not, since this could easily be done calling node.reactivate() in the init event.
    See fireActivate option
  2. Precedence
    When we reload, and the tree data (or initial Ajax response) contains nodes with a status (i.e. active, expanded, selected) should we still override this with the cookie information? --> see `overrideSource``option
  3. Lazy trees
    When a page with a lazy tree is reloaded, expanded nodes may no longer be available.
    To retain the active node, it may be necessary reload its parent nodes via ajax first. --> see expandLazy option
  4. Multi-hier selection
    This feature must be compatible with selectMode: 3 (see SpecSelect) --> We currently store only the key of selected top nodes using tree.getSelectedNodes(true) and call fixSelection3AfterClick() for those nodes when they are restored.

Proposal

Current Specification

TODO (see the demo)

Clone this wiki locally