如何清除/重新加载/刷新 JQuery 异步树视图?

发布于 2024-09-06 13:59:16 字数 1176 浏览 1 评论 0原文

我已经实现了 JQuery Async Treeview(在 APS.NET MVC2 中)并且工作正常,但问题是当用户向树添加新节点(通过另一个接口)时,无法重新加载树并反映新的树结构。

查看树中变化的唯一方法是关闭浏览器(IE8)。每次重新加载时在树上尝试 .empty() 不会执行任何操作:(

这是页面源代码:

    <script src="/Scripts/jquery.treeview.js" type="text/javascript"></script>
<script src="/Scripts/jquery.treeview.async.js" type="text/javascript"></script>   
<script type="text/javascript">
    $(document).ready(function() {           
        $('#organizationStructure').empty();
        $('#organizationStructure').treeview({
            url: '/OrganizationStructure/Browse/',
            collapsed: true,
            animated: "medium",
            control: "#sidetreecontrol"
        });
    });
</script>

<h2><%= Html.Encode(ViewData["Message"]) %></h2>  
<p></p>
<div id="sidetreecontrol"> <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> </div> 
<p></p>    


<ul id="organizationStructure" class="filetree"></ul>

仅在第一次构建树时才调用 URL /OrganizationStructure/Browse..我一生都无法理解它即使单击浏览器“刷新/重新加载”按钮也

可以重建,非常感谢。

I've implemented the JQuery Async Treeview (in APS.NET MVC2) and it works fine, but the problem is when the user adds new nodes to a tree (via another interface), there is no way to reload the tree and reflect the new tree structure.

The only way to see the changes in the tree is to shut down the browser (IE8). Trying .empty() on the tree on every reload doesnt do anything :(

Heres the page source:

    <script src="/Scripts/jquery.treeview.js" type="text/javascript"></script>
<script src="/Scripts/jquery.treeview.async.js" type="text/javascript"></script>   
<script type="text/javascript">
    $(document).ready(function() {           
        $('#organizationStructure').empty();
        $('#organizationStructure').treeview({
            url: '/OrganizationStructure/Browse/',
            collapsed: true,
            animated: "medium",
            control: "#sidetreecontrol"
        });
    });
</script>

<h2><%= Html.Encode(ViewData["Message"]) %></h2>  
<p></p>
<div id="sidetreecontrol"> <a href="?#">Collapse All</a> | <a href="?#">Expand All</a> </div> 
<p></p>    


<ul id="organizationStructure" class="filetree"></ul>

the URL /OrganizationStructure/Browse is only called when the tree is being built the first time..i cant for the life of me get it to rebuild even when the browsers "Refresh/Reload" button is clicked.

Any help would be GREATLY appreciated. Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

囚我心虐我身 2024-09-13 13:59:16

编辑:惊喜 - 文档就绪时的empty()然后treeview()在Chrome和FF中都可以正常工作,但在IE8中不行:P

仍然迷失在这个......

是否有可能每次展开节点时总是调用 url?我不知道一旦它已经加载,是什么阻止了它

再次感谢

EDIT: Surprise surprise - empty() then treeview() on document ready works fine in both Chrome and FF, but not IE8 :P

Still lost on this one...

is it possible to ALWAYS call the url everytime a node is expanded? I have no idea whats stopping it once its already loaded

Thanks again

嘦怹 2024-09-13 13:59:16

这个答案中找到了答案:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]

Found the answer in this answer:

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文