2012-06-25 52 views
0

我使用jstree 1.0和所有jstree网站功能,除了保持页面之间的树的状态很好。生产空饼干

的代码是:

$(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]; 
     } 
    }) 

});

当我检查的实际饼干他们是空的,我不知道为什么。这似乎是树项目链接到其他页面的事实意味着树在收到LI已被点击的事件之前导航离开,因此没有写入cookie。我提到this其他树形码的stackoverflow答案。我为每个LI使用一个ID。

请让我知道你是否可以在这里看到问题,以及如何将树状态信息写入cookie。

回答

2

解决了这一问题。原来是在我的UL中定义ID的语法错误。损失时间,但它工作时值得。