bootstrap-treeview是什么

bootstrap-treeview是一款效果非常酷的基于bootstrap的jQuery多级列表树插件。

怎样使用bootstrap-treeview

插件依赖

boostrap-treeview插件依赖于jquery和bootstrap,需要引用相对应版本的这两个插件才能使用bootstrap-treeview。

引用bootstrap-treeview

需要应用bootstrap-treeview.js文件可以从github下载

html结构

可以使用任何html dom元素作为改列表树容器

<div id="dictree"></div>

调用插件

angular.element("#dicTree").treeview({
data: respose.data,
levels: 2,
color: '#000000',
backColor: '#FFFFFF',
href: '#node-1'
});

其中data为我们的数据,数据以数组对象的形式组织,还可以设置如上其他属性背景色、前景色、默认展开的级别。

数据结构

在本次实例中我们使用了三个属性,text、id、href属性,数据结构如下:

[{
"id":"41",
"text":"业务字典",
"href":"01",
"nodes":[{
"id":"42",
"text":"法律法规管理系统",
"href":"001","
nodes":[{
"id":"24","text":
"业务类别","href":"0001",
"nodes":null}]}]}]

与angular结合

通过调用http远程服务调用服务器上的数据,也就是已经写好的接口:

(function () {
var controllerId = 'app.views.dictionarymanager.index';
var myModule = angular.module("app");
myModule.controller(controllerId, ['$scope','$http', function ($scope,$http) {
//初始化treeview
getDictinary();
function getDictinary() {
$http({ method: 'get', url: '/api/DictionaryMain/get' }).then(
function sunccessCallback(respose) {
angular.element("#dicTree").treeview({
data: respose.data,
levels: 2,
color: '#000000',
backColor: '#FFFFFF',
href: '#node-1'
});
}, function errorCallback(respose) {
alert(respose.data);
});
}
}]);
})();

其他

其他内容不在本次介绍的范围内,如全局参数、可用的方法和事件不在本次讨论范围内,如果想要详细了解请访问链接

bootstrap-treeview + angular 使用的更多相关文章

  1. Bootstrap treeview增加或者删除节点

    参考(AddNode: http://blog.csdn.net/qq_25628235/article/details/51719917,deleteNode:http://blog.csdn.ne ...

  2. 初始化bootstrap treeview树节点

    最近在做启明星图库时,使用了Jquery Bootstrap  Treeview插件.但是,遇到了一个初始化的问题.先看效果如下: 当用户打开图库时,左边分类第一个类别是“所有分类”,默认需要选中. ...

  3. angularJs , json,html片段,bootstrap timepicker angular

    css .demotest { width: %; height: auto; overflow: auto; position: relative; margin: auto; margin-top ...

  4. AngularJs angular.bind、angular.bootstrap、angular.copy

    angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...

  5. 【angular+bootstrap】angular初级的时间选择器

    近期的一个项目,是用angular来写的,本来框架就是第一次接触,使用相关插件的时候就感觉更加没有头绪了,其中一个插件就是时间选择器.比较好用时间选择器就是bootstrap里面的datetimepi ...

  6. BootStrap TreeView使用示例

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Angular - - angular.bind、angular.bootstrap、angular.copy

    angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...

  8. Angular Js 与bootstrap, angular 与 vue.js

    今天突然接到电话, 问我他们的区别  虽然平时看了,但是没记住,凉凉是肯定的 总结一下: bootstrap不算是javascript框架,它只是一个前端的ui框架,然后有一些附带的js插件而已.an ...

  9. bootstrap treeview 树形数据生成

    这个问题还是挺经典的,后台只是负责查出所有的数据,前台js来处理数据展示给treeview;show you the code below:<script> $(function () { ...

  10. bootstrap treeview实现菜单树

    本博客,介绍通过Bootstrap的treeview插件实现菜单树的功能. treeview链接:http://www.htmleaf.com/Demo/201502141380.html ORM框架 ...

随机推荐

  1. 使用select实现多并发的socket的功能

    select是一个io多路复用的io模型,也叫做事件驱动的io模型,我们今天用select来实现一个多并发的socket的聊天的程序 先看下server端的代码 import socket impor ...

  2. php.ini memory_limit引起的问题

    故障现象    在运行PHP程序,通常会遇到“Fatal Error: Allowed memory size of xxxxxx bytes exhausted”的错误, 这个意味着PHP脚本使用了 ...

  3. adf常用方法总结

    1.使用clientAttribute传值.获取值 或组件上面放客户端属性 <af:selectBooleanCheckbox text="" label="&qu ...

  4. windows文件属性操作 dsofile

    dsofile.dll是com组件,.net程序中引用dsofile.dll文件后,程序集名称会变成“Interop.DSOFile.dll”, com组件需要用regsvr32注册,所以需要注册ds ...

  5. Halcon的编程语法与数据处理——第8讲

    1.跟其他语言不完全一致的表达符号 赋值符号  := 引号      ' ' (一律是单引号) 求商求余  /   % (一个整数除以另一个数,如何使商是实型的?即浮点型) 逻辑运算  and  or ...

  6. apache的80端口被占用

    1.netstart -ano | findstr "80":查看80端口是否被占用,并找出对应的pid 2.关掉pid对应的进程

  7. stl中char 与wchar 的转换

    学习记录: stl中 字符串 str自然对应的是string 宽字符串wchar 对应的是wstring 宽字符串占用两个字节 两者的转换有三种办法 1 windows 的api转换函数WideCha ...

  8. Linux操作系统Vim代码Tab自动补全配置

    function! CleverTab() , col( ) =~ '^\s*$' return "\<Tab>" else return "\<C-N ...

  9. 2018.10.23 hdu4745Two Rabbits(区间dp)

    传送门 区间dp经典题目. 首先断环为链. 然后题目相当于就是在找最大的回文子序列. 注意两个位置重合的时候相当于范围是n,不重合时范围是n-1. 代码: #include<bits/stdc+ ...

  10. 2018.10.16 spoj Can you answer these queries V(线段树)

    传送门 线段树经典题. 就是让你求左端点在[l1,r1][l1,r1][l1,r1]之间,右端点在[l2,r2][l2,r2][l2,r2]之间且满足l1≤l2,r1≤r2l1\le l2,r1 \l ...