我的 jstree 有一些问题。
我的代码如下:
<div id="jstree">
<ul>
<li>Folder 1
<ul>
<li id="child_1">Child 1</li>
<li>Child 2</li>
</ul>
</li>
<li>Folder 2</li>
<ul>
<li id="child_1">Child 1</li>
<li>Child 2</li>
</ul>
</ul>
</div>
$('#jstree').jstree({
'core' : {'multiple' : false},
'state' : { 'key' : 'jsCategoryTree', 'events' : 'activate_node.jstree'},
'plugins' : ['state','cookies','ui','html_data'],
'cookies' : { 'keep_selected':true},
'themes': {'icons':false}
});
// return data selected option
$('#jstree').on('changed.jstree', function (e, data) {
console.info(data.node.id);
});
http://jsfiddle.net/4mtyu/764/
我有一些树,这个对象有一些值(value)。当我重新加载之前选择的页面时,会正确返回,但数据却不会。刷新页面后如何返回数据选定选项?
最佳答案
好的,我解决了我的问题。
$('#jstree').jstree("get_selected", true);
此代码在重新加载页面后返回所选选项的数据:)
关于javascript - 刷新页面后返回jstree中加载状态的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33146748/