2013-04-05 3 views
0

나는 나무를 표시하고 관리하기 위해 jstree jquery 플러그인을 사용하고 있습니다.jquery/jstree는 처음에 자식 노드를 보여줍니다.

0: {id:35, name:amrs trade, parent_id:null} 
1: {id:36, name:trips, parent_id:35} 
2: {id:37, name:tribute, parent_id:null} 
3: {id:38, name:music, parent_id:null} 
4: {id:39, name:recordings, parent_id:38} 
5: {id:40, name:live shows, parent_id:38} 
6: {id:41, name:others, parent_id:null} 
7: {id:42, name:investments, parent_id:null} 
8: {id:43, name:gold & silver, parent_id:42} 
9: {id:44, name:debentures, parent_id:42} 
10: {id:46, name:production, parent_id:35} 
11: {id:54, name:real estate, parent_id:42} 

내 트리를 렌더링 만들기 위해 사용하고 있습니다 : 이것은 JSON 데이터입니다

내가 트리를 표시하고 일부 선택된 노드는 현재 (처음 오픈하고 싶지
$("#incomeCategoryTree").jstree({ 
    "json_data" : { 
     "data" : income, 
     "progressive_render" : true 
    }, 
    "plugins" : [ "themes", "json_data" ] 
}) 

, 최상위 레벨 만 표시되고 최상위 레벨이 아닌 모든 노드는 숨겨 짐). jstree가 처음에 선택한 노드를 확장하도록하기 위해 위의 json에 어떤 옵션을 추가 할 수 있습니까?

답변

0

상태 :

0: {id:35, name:amrs trade, parent_id:null, state:open} 
1: {id:36, name:trips, parent_id:35} 
2: {id:37, name:tribute, parent_id:null} 
3: {id:38, name:music, parent_id:null} 
4: {id:39, name:recordings, parent_id:38} 
5: {id:40, name:live shows, parent_id:38} 
6: {id:41, name:others, parent_id:null} 
7: {id:42, name:investments, parent_id:null, state:closed} 
8: {id:43, name:gold & silver, parent_id:42} 
9: {id:44, name:debentures, parent_id:42} 
10: {id:46, name:production, parent_id:35} 
11: {id:54, name:real estate, parent_id:42} 
: open/ closed는 일을
관련 문제