2014-12-10 3 views
2

방금 ​​fancytree 2.6.0을 시작했고 웹 서비스 요청에서 채워 넣었습니다.Fancytree가 보이지 않습니다. class가 ui-helper-hidden입니다.

제 문제는 모든 노드가 있지만 ui-helper-hidden 클래스에서 보이지 않게 만드는 것입니다. 임시 픽스를 $ (rootNode.ul) .removeClass ('ui-helper-hidden'); 그러나 나는 뭔가를 놓치고 있다고 확신합니다.

스크립트와 CSS :

<link href="Scripts/jquery-plugins/fancytree-2.6.0/src/skin-themeroller/ui.fancytree.css" rel="stylesheet" type="text/css" /> 
<script src="Scripts/jquery-1.11.1/jquery-1.11.1.js" type="text/javascript"></script> 
<script src="Scripts/jquery-1.11.1/jquery-migrate-1.2.1.js" type="text/javascript"></script> 
<script src="Scripts/jquery-ui-1.11.2/jquery-ui.js" type="text/javascript"></script> 
<script src="Scripts/jquery-plugins/fancytree-2.6.0/src/jquery.fancytree.js" type="text/javascript"> </script> 
<script src="Scripts/jquery-plugins/fancytree-2.6.0/src/jquery.fancytree.themeroller.js" type="text/javascript"> </script> 

이 코드는 :

$('#selectedClausesDiv').fancytree(); 

$.when(
    $.getJSON("Handlers/GetQuotationHandler.ashx?jsoncallback=?", { quoteReference: quoteReference, quoteVersion: quoteVersion }) 
).then(function (data) { 
    if (data.ErrorCode == 0 && data.Quotation != null) { 
     var rootNode = $("#selectedClausesDiv").fancytree("getRootNode"); 
     $.each(data.Quotation.Covers, function (index, item) { 
      addCover(rootNode, item); 
     }); 

     // FIXME: why is this necessary ?? 
     // $(rootNode.ul).removeClass('ui-helper-hidden'); 
    } 
}); 

function addCover(rootNode, cover) { 
    var coverId = 'selected_' + cover.BusinessClassId + '_' + cover.CoverId; 

    var coverNode = rootNode.addChildren({ 
     title: cover.Name, 
     tooltip: "This folder and all child nodes were added programmatically.", 
     folder: true 
    }); 
} 

은 생성 된 HTML은 :

<div class="grid_13 alpha omega" id="selectedClausesDiv"> 
    <ul class="ui-fancytree fancytree-container ui-fancytree-source ui-helper-hidden" tabindex="0"> 
     <li class=""> 
      <span class="fancytree-node fancytree-folder fancytree-exp-n fancytree-ico-cf"> 
       <span class="fancytree-expander"/> 
       <span class="fancytree-icon"/> 
       <span title="This folder and all child nodes were added programmatically." class="fancytree-title">P&amp;I Owned</span> 
      </span> 
     </li> 
     <li class="fancytree-lastsib"> 
      <span class="fancytree-node fancytree-folder fancytree-lastsib fancytree-exp-nl fancytree-ico-cf"> 
       <span class="fancytree-expander"/> 
       <span class="fancytree-icon"/> 
       <span title="This folder and all child nodes were added programmatically." class="fancytree-title">P&amp;I Extended Cargo</span> 
      </span> 
     </li> 
    </ul> 
</div> 
은 는

답변

6

Fancytree 자동으로 루트 요소를 숨길 데이터 소스가 제공되지 않는 경우 .

API를 사용하고 초기 소스가없는 데이터를 추가하는 경우 빈 source 옵션을 제공하면 Fancytree가 루트 요소를 숨길 수 없습니다.

$("#tree").fancytree({ 
    source: [] 
});