【问题标题】:Bootstrap treeview expand collapse icon coming for leaf nodes引导树视图展开折叠图标出现在叶节点上
【发布时间】:2015-07-09 08:45:40
【问题描述】:

我正在使用bootstrap treeview。出于某种原因,即使叶节点也有展开/折叠图标。我只想为非叶节点显示展开/折叠图标?

我正在使用以下配置:

  $('#tree').treeview({data: scope.tree, showCheckbox: true});
  $('#tree').treeview('collapseAll', { silent: true });

我确信必须有一个配置来启用禁用树视图中叶节点的展开/折叠图标。

【问题讨论】:

    标签: twitter-bootstrap angular-ui-bootstrap bootstrap-treeview


    【解决方案1】:

    回答我自己的问题,在 JSON 中,节点属性 需要设置为 null 用于叶节点。 我将其发送为 empty array []

    var tree = [
      {
        text: "Parent 1",
        nodes: [
          {
            text: "Child 1",
            nodes: [
              {
                text: "Grandchild 1"
              },
              {
                text: "Grandchild 2"
              }
            ]
          },
          {
            text: "Child 2"
          }
        ]
      },
    
      {
        text: "Parent 4"
        nodes: []  // =======> set this as null
      }
    ];
    

    【讨论】:

      猜你喜欢
      • 2012-01-19
      • 1970-01-01
      • 2017-11-24
      • 2010-12-15
      • 1970-01-01
      • 1970-01-01
      • 2011-05-29
      • 2013-07-01
      • 2023-04-03
      相关资源
      最近更新 更多