我使用jsTree顯示我的數據庫層次類別,如交互式樹。初始加載是使用JSON完成的,默認情況下會檢查某些類別。 jsTree知道選擇了哪些類別,因爲它將它們顯示爲已選中(我正在使用複選框插件),但我希望能夠在樹負載中打開已檢查的節點(及其所有父項)。如何在jstree加載時打開選定(檢查)的節點?
我需要的,因爲當用戶打開一個頁面樹,他不知道,有可能是在不擴展整個樹中選擇一些類,我想擴大隻是那些被檢查的節點。
這是我到目前爲止的代碼:
var tree = $('.tree').bind('loaded.jstree', function (e, data) {
// I assume that logic that expand checked nodes must be placed here, after tree is loaded
})
.jstree({
// Configure JSON data plugin
'json_data': {
'data': [<this is initial json data>]
},
'checkbox': {
'override_ui': true,
'two_state': true,
'real_checkboxes': true
},
// Specify which plugins to load
'plugins': ['themes', 'json_data', 'ui', 'checkbox']
});
謝謝!
沒有ü找到任何解決這個?我正在尋找相同的解決方案。 – highwingers