JQuery JSTree 加载为打开状态,然后最小化
拳头,潜伏多年,希望这篇文章不仅对我有帮助。
所以我有一个使用非常少量的 JavaScript 为我的网站生成的 jstree。理想情况下,我希望页面仅加载并显示 2 个顶部文件夹。
然而,目前页面显示所有文件夹、子文件夹、文件等的名称大约需要 0.5 秒,然后才会切换到正确的视图。树结构中可能有大约 200 个项目
,我添加了一个手动 tree.bind ,它执行“close_all”,并且我还尝试隐藏它最终出现的 DIV。即使我在创建后放置了代码来显示 DIV树,在隐藏自己之前,它仍然显示出一切。
我正在使用 jsTree 1.0-rc3
大家有什么想法吗?
<script type="text/javascript">
(document).ready(function () {
var tree = $("#sharepointHierarchy");
tree.bind("loaded.jstree", function (event, data) {
tree.jstree("close_all");
});
$("#sharepointHierarchy").jstree({
'plugins' : [ "themes", "html_data", "types", "ui" ],
'core' : {/* core options go here */},
});
document.getElementById("sharepointHierarchy").style.display="block";
});
</script>
Fist off, been lurking for years, hopefully this post will be helpful to more than just me.
So I have a jstree that is generated for my site using very a small amount of JavaScript. Ideally, I would like for the page to load and show the 2 top folders only.
However, currently the page displays all of the names of the folders, subfolders, files, etc. for about 0.5 seconds before switching to the proper view. There are probably about 200 items in the tree structure
I added a manual tree.bind which does a "close_all", and I also tried hiding the DIV that it eventually appears in. Even though I put the code to show the DIV after I create the tree, it still shows everything before hiding itself.
I am using jsTree 1.0-rc3
Anyone have any thoughts?
<script type="text/javascript">
(document).ready(function () {
var tree = $("#sharepointHierarchy");
tree.bind("loaded.jstree", function (event, data) {
tree.jstree("close_all");
});
$("#sharepointHierarchy").jstree({
'plugins' : [ "themes", "html_data", "types", "ui" ],
'core' : {/* core options go here */},
});
document.getElementById("sharepointHierarchy").style.display="block";
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过将以下代码添加到 function() 的末尾来掩盖这个问题。它相当简单,只是在显示之前给表格一些时间来加载。
我希望这对其他人也有帮助。
I was able to mask this issue by adding the following code to the end of the function(). It is fairly straight-forward and simply gives the table time to load before showing it.
I hope this helps someone else also.