【问题标题】:jstree get data after updatejstree更新后获取数据
【发布时间】:2014-02-23 18:05:26
【问题描述】:

我在 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" }
]

【问题讨论】:

    标签: javascript jquery json jstree


    【解决方案1】:

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

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

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

    如果有其他问题,请告诉我。

    【讨论】:

      猜你喜欢
      • 2015-02-21
      • 2015-11-18
      • 1970-01-01
      • 1970-01-01
      • 2013-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多