views:

62

answers:

0

I'm using jstree jQuery plugin, and I'm using the cookie plugin to save previously selected node on refresh.

However, if the tree structure contains two nodes with the same name (under different parents), both will be selected on a refresh.

Anybody know how come, and what to do about it?

Here's the code:

    $("#divLeftPane")
            .bind("reselect.jstree", function () {

 if ($(".jstree-clicked").length == 0)
                    url = "";
                else
                    url = "?url=" + $(".jstree-clicked").attr("rel");
                loadFiles(url);
                $("#currentDir").val($(".jstree-clicked").attr("rel"));


                $("a").click(function () {
                    url = "?url=" + $(this).attr("rel");
                    loadFiles(url);
                    $("#currentDir").val($(this).attr("rel"));
                });
            }).jstree({
                "html_data": {
                    "ajax": {
                        "url": "/Customers/Directories/"
                    }
                },
                "ui": {
                    "select_limit": 2,
                    "select_multiple_modifier": "alt",
                    "selected_parent_close": "select_parent"//,
                    //                  "initially_select": ["phtml_2"]
                },
                "themes": {
                    "theme": "classic",
                    "dots": false,
                    "icons": true
                },

                "plugins": ["themes", "html_data", "ui", "cookies"]
            });
};