2014-04-01 1 views
0

폴더 및 문서를 표시하는 jstree가 있습니다. 그러나 모든 노드에서 폴더 아이콘이 표시됩니다. 나는 그것을 문서 또는 폴더 (0 폴더, 1 문서) 여부를 결정하는 내 json 형식 속성이 있지만 그것을 전환하는 방법을 알아낼 수 없습니다. 내 코드는 다음과 같습니다. 외부 어디를 반대jstree 일부 노드의 문서 아이콘 표시

+0

당신은 CSS 파일 및 심상 폴더에있는 모든 심상이 있는가? – ProllyGeek

답변

0

문제는 내 타입 정의와 플러그인 태그가 핵심 내부했다

내가 the demo page에서 코드를 복사 시도했지만 명확하게 사전에

$('#tree').jstree({ 
      'core': { 
       'plugin': ['themes', 'types'], 
       "types": { 
        "#": { 
         "valid_children": ["file"] 
        }, 
        "file": { 
         "icon": "/Styles/file.png", 
         "valid_children": [] 
        } 
       },     
       'check_callbacks': true, 
       'themes': { 'stripes': true }, 
       'data': { 
        type: 'POST', 
        contentType: 'application/json; charset=utf-8', 
        url: 'V2_DocTreeView.aspx/GetChildrenFor', 
        data: function (node) { 
         var group = 0; 
         if (node.id == "#") 
          group = getParameterByName("group"); 
         else 
          group = node.id; 
         return '{id: "' + group + '"}'; 
        } 
       } 
      } 
     } 
     ) 

감사를 작동하지 않습니다이었다 또한 json (내 모델)이 type 속성을 올바로 설정하지 못했습니다. 이것은 나무가 어떻게 보일 것입니다

  $('#tree').jstree({ 
      'core': { 
       'check_callback': true, 
       'themes': { 'stripes': true }, 
       'data': { 
        type: 'POST', 
         contentType: 'application/json; charset=utf-8', 
        url: 'V2_DocTreeView.aspx/GetChildrenFor', 
        data: function (node) { 
         var group = 0; 
         if (node.id == "#") 
          group = getParameterByName("group"); 
         else 
          group = node.id; 
         return '{id: "' + group + '"}'; 
        } 
       } 
      }, 
      'types': { 
       "default": { 
        "valid_children": ["default", "file"] 
       }, 
       "file": { 
        "icon": "./Styles/file.png", 
        "valid_children": [] 
       } 
      }, 
      'plugins': ['types'] 
     }