有人可以让我在这个上揭示一些灯吗?

我无法弄清楚为什么有一个null root,渲染我返回的json objectthat。孩子们存在于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>
.

这是一个截断的(for space)返回的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