2014-02-23 52 views
0

我在jstree中傳遞一些json數據,然後更新樹。 比如我最初的數據是jstree在更新後獲取數據

[ 
    { "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" } 
] 

回答

2

Okay..so基本上,如果你想刷新樹更新的數據,然後更新用代碼後,調用jstree回調:

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

這將刷新樹新json數據。

如果還有其他問題,請告知我。

+0

代碼不能正常工作,請幫忙! – atefth