jsTree cookie错误
我是 jsTree 的新手,在一个非常简单的示例中遇到问题。
我的 html:
<ul id='categories'>
<li><a href"/Browse/1">Category 1</a>
<ul>
<li><a href="/Browse/3">Subcategory 1.1</a></li>
</ul>
</li>
<li><a href="/Browse/2">Category 2</a>
<ul>
<li><a href="/Browse/4">Subcategory 2.1</a></li>
</ul>
</li>
</ul>
代码:
<script type='text/javascript'>
$(document).ready(function() {
$('#categories').jstree({ 'plugins' : 'html_data' });
});
</script>
错误:
Line: 1694
Error: Exception thrown and not caught
似乎 jsTree 正在尝试调用我尚未安装的 cookie 插件。
就我而言,我不需要也不想要 cookie。
没有它们我如何运行 jsTree?
更新:
我尝试了这个加上各种插件组合:
<script type='text/javascript'>
$(document).ready(function() {
$.jstree.defaults.plugins = ['ui', 'crrm', 'themes', 'html_data'];
$('#categories').jstree();
});
</script>
现在的结果是一个空白页面。不过错误已经消失了。
谢谢你,
瑞克
I am new to jsTree and am having problems with a very simple example.
My html:
<ul id='categories'>
<li><a href"/Browse/1">Category 1</a>
<ul>
<li><a href="/Browse/3">Subcategory 1.1</a></li>
</ul>
</li>
<li><a href="/Browse/2">Category 2</a>
<ul>
<li><a href="/Browse/4">Subcategory 2.1</a></li>
</ul>
</li>
</ul>
Code:
<script type='text/javascript'>
$(document).ready(function() {
$('#categories').jstree({ 'plugins' : 'html_data' });
});
</script>
Error:
Line: 1694
Error: Exception thrown and not caught
It appears as though jsTree is trying to call the cookie plugin which I do not have installed.
In my case, I do not need or want cookies.
How can I run jsTree without them?
UPDATE:
I tried this plus various combinations of plugins:
<script type='text/javascript'>
$(document).ready(function() {
$.jstree.defaults.plugins = ['ui', 'crrm', 'themes', 'html_data'];
$('#categories').jstree();
});
</script>
The result now is a blank page. The error has gone away though.
Thank you,
Rick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看第 1755 行,默认情况下会使用 cookies 插件:
要删除它,您的选项必须是一个数组,因此它会覆盖而不是添加到默认值,如下所示:
这包括默认添加的其他内容,只需删除任何你不想要的。
此外,该结构需要对
html_data
进行一些更改才能正常工作,如下所示:注意父元素和锚点的添加。 您可以在这里尝试一下。
If you look at line 1755, the cookies plugin is being used by default:
To remove it your option must be an array so it overrides rather than adds to the defaults, like this:
This includes the others that are added by default, just remove any you don't want.
Also the structure needs a bit of a change for
html_data
to work, like this:Note the addition of the parent element and the anchors. You can give it a try here.