达到第9级时,abn树无法正确显示 [英] abn tree fail to show correctly when reach to level 9

查看:65
本文介绍了达到第9级时,abn树无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须生成树状视图,因此我在Spring Boot Jhipster应用程序中使用abn-tree创建了树.

I have to generate tree view, so I have created tree using abn-tree in my spring boot jhipster application.

由于将在运行时生成树,因此树的级别(深度)不固定.我曾尝试过使用Abn-tree的深度8,但当深度达到9时,其视线便散乱了.向右移动后添加的节点和整个树形视图均无法正确显示.

As tree will be generated at runtime and level(depth) of tree is not fixed. I have tried depth 8 with abn-tree, but as it go to level 9, its view scattered. Node added after shifted towards right side and whole tree view not display correct.

我需要Windows注册表编辑器之类的树结构:

I need tree structure like Windows Registry Editor as :

您可以在以下位置检查问题: http://embed.plnkr.co/Nxi2Nl/通过将数据放入app.js:

You can check the issue at : http://embed.plnkr.co/Nxi2Nl/ by putting data in app.js:

var app = angular.module('plunker', ['angularBootstrapNavTree']);

app.controller('MainCtrl', function($scope) {
  $scope.name = 'World';

  var treedata_geography = [{
    label: 'North America',
    children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
     children: [{
      label: 'Canada',
     children: [{
      label: 'Canada',
     children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
      children: [{
      label: 'Canada',
      children: ['Toronto', 'Vancouver']
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
    }, {
      label: 'USA',
      children: ['New York', 'Los Angeles']
    }, {
      label: 'Mexico',
      children: ['Mexico City', 'Guadalajara']
    }]
  }, {
    label: 'South America',
    children: [{
      label: 'Venezuela',
      children: ['Caracas', 'Maracaibo']
    }, {
      label: 'Brazil',
      children: ['Sao Paulo', 'Rio de Janeiro']
    }, {
      label: 'Argentina',
      children: ['Buenos Aires', 'Cordoba']
    }]
  }];
  $scope.my_data = treedata_geography;

});

如何解决此问题.我尝试了各种CSS更改.如果这不能解决问题,那么什么时候最好使用扩展折叠功能在运行时生成树.

How can I resolve the issue. I have tried various css changes. If this will not solve the issue then what will best to generate tree on runtime with expand collapse feature.

推荐答案

查看.css文件(您尚未将其包含在问题中,但应在其中放置相关代码).

Look in the .css file (which you haven't included in your question, but you should put the relevant code in there).

您会看到,列表项仅定义了9个缩进级别,因此在9个缩进级别之后,它们会回落到左边距.CSS中的最后一个级别是:

You'll see that only 9 levels of indentation are defined for the list items, so after nine levels, they fall back to the left margin. The last level in the CSS is:

ul.nav.nav-list.abn-tree .level-9 .indented {
  position: relative;
  left: 160px;
}

只需根据需要添加更多级别,然后每20个像素缩进更多

Just add more levels as desired, and indent each 20 pixels more:

ul.nav.nav-list.abn-tree .level-10 .indented {
  position: relative;
  left: 180px;
}

ul.nav.nav-list.abn-tree .level-11 .indented {
  position: relative;
  left: 200px;
}

等等

这篇关于达到第9级时,abn树无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆