문제

누군가 가이 하나에 빛을 흘리게 할 수 있습니까?

JSON objectthat을 위해 렌더링하는 null 루트가있는 이유를 알아낼 수 없습니다.아이들은 JSON과 렌더링 된 JS에 있습니다.

<ul class="dynatree-container">
<li class="dynatree-lastsib">
<span class="dynatree-node etc">
<span class="dynatree-expander"></span>
<span class="dynatree-icon"></span>
    *<a class="dynatree-title" href="#">null</a>*
</span>
    <ul style="">
        <li class="">
        <span class="dynatree-node etc">
        </li>
        <li class="">
            <span class="dynatree-node etc">
        </li>
        <li class="">
        <li class="">
        <li class="">
        <li class="">
        <li class="dynatree-lastsib">
    </ul>
 </li>
</ul>
.

여기에 반환 된 JSON 객체가 반환 된 (공백의 경우)입니다.

  "children": [
    {
      "key": "0",
      "title": "new  2.txt",
      "isFolder": false,
      "isLazy": false,
      "activate": false,
      "focus": true,
      "expand": true,
      "select": false,
      "hideCheckbox": false,
      "unselectable": false,
      "icon": "images/word.gif"
    },
    {
      "key": "0",
      "title": "tmp001.xls",
      "isFolder": false,
      "isLazy": false,
      "activate": false,
      "focus": true,
      "expand": true,
      "select": false,
      "hideCheckbox": false,
      "unselectable": false,
      "icon": "images/word.gif"
    },
    {
      "key": "0",
      "title": "new  4.txt",
      "isFolder": false,
      "isLazy": false,
      "activate": false,
      "focus": true,
      "expand": true,
      "select": false,
      "hideCheckbox": false,
      "unselectable": false,
      "icon": "images/word.gif"
    }
  ]
.

여기에 내 JavaScript가 있습니다.

  <script>
    $(function(){
    $("#tree").dynatree({
        rootVisible:true,
        title:"Queue",
        rootCollapsible: false,
        selectionVisible: true,
        initAjax: {
            url: 'userProjectQueue.ge',
            cache:false
        },
    onActivate: function(node) {
      $("#echoActive").text(node.data.title + "(" + node.data.key + ")");
    },
    onDeactivate: function(node) {
      $("#echoActive").text("-");
    },
    dnd: {
      onDragStart: function(node) {

        logMsg("tree.onDragStart(%o)", node);
        if(node.data.isFolder)
          return false;
        return true;
      },
      onDragStop: function(node) {
        logMsg("tree.onDragStop(%o)", node);
      }
    }
  });
.

감사합니다

도움이 되었습니까?

해결책

rootVisible/rootCollapsible is no longer supported in the latest versions (the system root is always hidden). You should also not pass identical keys (it's ok to omit them though).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top