2011-06-16 92 views
1

在一次A​​JAX調用中,我從服務器獲取了x個項目及其相關目錄結構,然後從服務器斷開連接。現在所有的操作都應該從瀏覽器中運行。jsTree open_all始終未觸發

現在加載到Listbox和jsTree中的項目應該加載關聯數據onChange事件。一切正常,但jsTree的open_all僅適用於第一個Listbox單擊。之後它崩潰了。

這是我的代碼。

function Refresh(item) { 
    $('#MainTree').bind("loaded.jstree", function (e, data) { 
     $('#MainTree').jstree("open_all"); //WORKS FINE 
     //data.inst.open_all(-1); //WORKS FINE 
    }).jstree({ 
     "json_data": { 
      "data": [item] 
     }, 
     "themes": { 
      "theme": "default", 
      "dots": true, 
      "icons": true 
     }, 
     "ui": { 
      "select_limit": 1 
     }, 
     "plugins": ["themes", "json_data", "ui", "types"] 
    }); 
} 

而且下面是我的HTML按鈕的代碼,崩潰&開放也能正常工作。任何想法?

<input type="button" value="Collapse All" onclick="$('#MainTree').jstree('close_all');"> 
<input type="button" value="Expand All" onclick="$('#MainTree').jstree('open_all');"> 

回答

0

後嘗試的幾天裏,我放棄了這一個,並試圖TreeTable插件,它完美。

希望這可以幫助別人。