Issue 307: When selectMode is 3 (stopOnParent), only selected parents should be saved in cookies
Status:  WontFix
Owner: ----
Closed:  May 2014
Reported by siberia....@gmail.com, Apr 25, 2012
I have a huge tree of biological taxa (200), which may grow. It might become lazy later, but now it's loaded all together.

$("#species-tree").dynatree({
		persist: true,
		checkbox: true,
		selectMode: 3});

This is the code I initialize dynatree with. 

Everything is great, I love this library, but I wish it saved in cookies only the necessary nodes, that is, the parent selected nodes.

In Chromium Dev Tools I see, it saves all the checked nodes, including those hidden deep in the tree.
	
May 1, 2012
Project Member #1 moo...@wwwendt.de
(No comment was entered for this change.)
Labels: Milestone-Release1.2.1
Jun 6, 2012
Project Member #2 moo...@wwwendt.de
Deferred, so v1.2.1 can be released shortly.
Labels: -Milestone-Release1.2.1 Milestone-Release1.2.2
Oct 3, 2012
Project Member #3 moo...@wwwendt.de
(No comment was entered for this change.)
Status: Accepted
Oct 6, 2012
Project Member #4 moo...@wwwendt.de
not as easy to implement as I thought at first
Labels: -Type-Defect -Milestone-Release1.2.2 Type-Enhancement Milestone-Release1.2.x
Oct 6, 2012
#5 siberia....@gmail.com
Write me a private message, I have code that does it for my website.
Oct 6, 2012
Project Member #6 moo...@wwwendt.de
Suggested patch by Dmitri Lebedev

----

I'm not sure this can be a patch:

It checks items after init and in the end puts update_layer_cookie as onSelect listener.

    var update_layer_cookie = function(flag, node) {
            var selectedNodes = node.tree.getSelectedNodes(true),
                selectedKeys = $.map(selectedNodes, function(node) {
                    return node.data.key;
                });
            $.cookie('dynatree-select', selectedKeys.join(','));
            if (current_popup) {
                map.removePopup(current_popup);
            }
            layer2.refresh({force: true});
        },
        check_items = function(flag, node) {
            var tree = this,
                cookie = $.cookie('dynatree-select');
            if (cookie) {
                $.each(cookie.split(','), function (i, v) {
                    tree.selectKey(v);
                });
            }
            tree.options.onSelect = update_layer_cookie;
        };

    $("#species-tree").dynatree({
        checkbox: true,
        selectMode: 3,
        onPostInit: check_items
    });

Oct 6, 2012
Project Member #7 moo...@wwwendt.de
maybe implement  issue 287  (possibility to select what settings to persist, for example instead of saying persist: true, you could say persist: ['expand'] to only persist expand-state.)
May 1, 2014
Project Member #8 moo...@wwwendt.de
As of 2014 Dynatree is feature frozen.
Please have a look at Fancytree (sequel of DynaTree 1.x): chances are good that the problem was resolved / the requested featuer is already implemented.
Please open a new issue there otherwise:

https://github.com/mar10/fancytree
Status: WontFix
May 3, 2014
Project Member #9 moo...@wwwendt.de
(No comment was entered for this change.)
Labels: -Milestone-Release1.2.x Milestone-Release2.0