gpt4 book ai didi

javascript - jstree获取更新后的数据

转载 作者:行者123 更新时间:2023-12-02 17:43:32 25 4
gpt4 key购买 nike

我在 jstree 中传递一些 json 数据,然后更新树。例如我的初始数据是

[
{ "id" : "demo_root_1", "text" : "Root 1", "children" : true, "type" : "root" },
{ "id" : "demo_root_2", "text" : "Root 2", "type" : "root" }
]

我对其进行了一些更新(简单的重命名)。 “根 1”变为“已更新”。如何获取如下所示的 json 格式的数据的更新版本?

[
{ "id" : "demo_root_1", "text" : "UPDATED", "children" : true, "type" : "root" },
{ "id" : "demo_root_2", "text" : "Root 2", "type" : "root" }
]

最佳答案

好吧..所以基本上如果你想用更新的数据刷新树,那么在更新代码之后,调用 jstree 回调:

$(tree).jstree('refresh');

这将使用新的 json 数据刷新树。

如有进一步问题,请告诉我。

关于javascript - jstree获取更新后的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21972189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com