0

I am using jstree 1.0 and all is fine except for maintaining the tree state between pages.

The code is:

$(document).ready(function(){
$("#treeview").jstree({
    "themes" : {
        "theme" : "default",
        "dots" : false,
        "icons" : false
    },
    "cookies": { "cookie_options" : { path : "/" } },
    "ui" : {
            "selected_parent_close" : "false"
    },
    "core": { 
                "animation": 500
            },
    "plugins" : [ "themes", "html_data", "ui", "cookies" ]

}).bind("select_node.jstree", function(e, data)
    {
        var href = data.rslt.obj.children("a").attr("href");
        $("#contents").load(href);
        if (Right(window.location.href,href.length) == [href])  {
            return;
            }
        else {
            window.location=[href];  
        }
    })

});

When I examine the actual cookies they are empty and I'm not sure why not. It seems like the fact that the tree items link to other pages means that the tree navigates away before receiving the event that an LI has been clicked, hence nothing written to cookie. I referred to this other stackoverflow answer for the tree code. I am using an ID for each LI.

Please let me know if you can see the issue here and how to get tree state info written to the cookie.

Community
  • 1
  • 1
Rowland
  • 53
  • 5

1 Answers1

2

Fixed the problem. Turned out to be a syntax error in defining id's in my UL. Hours lost, but worth it when it works.

Rowland
  • 53
  • 5