# Bootstrap Tree View
---
![Bower version](https://img.shields.io/bower/v/bootstrap-treeview.svg?style=flat)
[![npm version](https://img.shields.io/npm/v/bootstrap-treeview.svg?style=flat)](https://www.npmjs.com/package/bootstrap-treeview)
[![Build Status](https://img.shields.io/travis/jonmiles/bootstrap-treeview/master.svg?style=flat)](https://travis-ci.org/jonmiles/bootstrap-treeview)
A simple and elegant solution to displaying hierarchical tree structures (i.e. a Tree View) while leveraging the best that Twitter Bootstrap has to offer.
![Bootstrap Tree View Default](https://raw.github.com/jonmiles/bootstrap-treeview/master/screenshot/default.PNG)
## Dependencies
Where provided these are the actual versions bootstrap-treeview has been tested against.
- [Bootstrap v3.3.4 (>= 3.0.0)](http://getbootstrap.com/)
- [jQuery v2.1.3 (>= 1.9.0)](http://jquery.com/)
## Getting Started
### Install
You can install using bower (recommended):
```javascript
$ bower install bootstrap-treeview
```
or using npm:
```javascript
$ npm install bootstrap-treeview
```
or [download](https://github.com/jonmiles/bootstrap-treeview/releases/tag/v1.2.0) manually.
### Usage
Add the following resources for the bootstrap-treeview to function correctly.
```html
<!-- Required Stylesheets -->
<link href="bootstrap.css" rel="stylesheet">
<!-- Required Javascript -->
<script src="jquery.js"></script>
<script src="bootstrap-treeview.js"></script>
```
The component will bind to any existing DOM element.
```html
<div id="tree"></div>
```
Basic usage may look something like this.
```javascript
function getTree() {
// Some logic to retrieve, or generate tree structure
return data;
}
$('#tree').treeview({data: getTree()});
```
## Data Structure
In order to define the hierarchical structure needed for the tree it's necessary to provide a nested array of JavaScript objects.
Example
```javascript
var tree = [
{
text: "Parent 1",
nodes: [
{
text: "Child 1",
nodes: [
{
text: "Grandchild 1"
},
{
text: "Grandchild 2"
}
]
},
{
text: "Child 2"
}
]
},
{
text: "Parent 2"
},
{
text: "Parent 3"
},
{
text: "Parent 4"
},
{
text: "Parent 5"
}
];
```
At the lowest level a tree node is a represented as a simple JavaScript object. This one required property `text` will build you a tree.
```javascript
{
text: "Node 1"
}
```
If you want to do more, here's the full node specification
```javascript
{
text: "Node 1",
icon: "glyphicon glyphicon-stop",
selectedIcon: "glyphicon glyphicon-stop",
color: "#000000",
backColor: "#FFFFFF",
href: "#node-1",
selectable: true,
state: {
checked: true,
disabled: true,
expanded: true,
selected: true
},
tags: ['available'],
nodes: [
{},
...
]
}
```
### Node Properties
The following properties are defined to allow node level overrides, such as node specific icons, colours and tags.
#### text
`String` `Mandatory`
The text value displayed for a given tree node, typically to the right of the nodes icon.
#### icon
`String` `Optional`
The icon displayed on a given node, typically to the left of the text.
For simplicity we directly leverage [Bootstraps Glyphicons support](http://getbootstrap.com/components/#glyphicons) and as such you should provide both the base class and individual icon class separated by a space.
By providing the base class you retain full control over the icons used. If you want to use your own then just add your class to this icon field.
#### selectedIcon
`String` `Optional`
The icon displayed on a given node when selected, typically to the left of the text.
#### color
`String` `Optional`
The foreground color used on a given node, overrides global color option.
#### backColor
`String` `Optional`
The background color used on a given node, overrides global color option.
#### href
`String` `Optional`
Used in conjunction with global enableLinks option to specify anchor tag URL on a given node.
#### selectable
`Boolean` `Default: true`
Whether or not a node is selectable in the tree. False indicates the node should act as an expansion heading and will not fire selection events.
#### state
`Object` `Optional`
Describes a node's initial state.
#### state.checked
`Boolean` `Default: false`
Whether or not a node is checked, represented by a checkbox style glyphicon.
#### state.disabled
`Boolean` `Default: false`
Whether or not a node is disabled (not selectable, expandable or checkable).
#### state.expanded
`Boolean` `Default: false`
Whether or not a node is expanded i.e. open. Takes precedence over global option levels.
#### state.selected
`Boolean` `Default: false`
Whether or not a node is selected.
#### tags
`Array of Strings` `Optional`
Used in conjunction with global showTags option to add additional information to the right of each node; using [Bootstrap Badges](http://getbootstrap.com/components/#badges)
### Extendible
You can extend the node object by adding any number of additional key value pairs that you require for your application. Remember this is the object which will be passed around during selection events.
## Options
Options allow you to customise the treeview's default appearance and behaviour. They are passed to the plugin on initialization, as an object.
```javascript
// Example: initializing the treeview
// expanded to 5 levels
// with a background color of green
$('#tree').treeview({
data: data, // data is not optional
levels: 5,
backColor: 'green'
});
```
You can pass a new options object to the treeview at any time but this will have the effect of re-initializing the treeview.
### List of Options
The following is a list of all available options.
#### data
Array of Objects. No default, expects data
This is the core data to be displayed by the tree view.
#### backColor
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
Sets the default background color used by all nodes, except when overridden on a per node basis in data.
#### borderColor
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
Sets the border color for the component; set showBorder to false if you don't want a visible border.
#### checkedIcon
String, class names(s). Default: "glyphicon glyphicon-check" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
Sets the icon to be as a checked checkbox, used in conjunction with showCheckbox.
#### collapseIcon
String, class name(s). Default: "glyphicon glyphicon-minus" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
Sets the icon to be used on a collapsible tree node.
#### color
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
Sets the default foreground color used by all nodes, except when overridden on a per node basis in data.
#### emptyIcon
String, class name(s). Default: "glyphicon" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
Sets the icon to be used on a tree node with no child nodes.
#### enableLinks
Boolean. Default: false
Whether or not to present node text as a hyperlink. The href value of which must be provided in the data structure on a per node basis.
#### expandIcon
String, class name(s). Default: "glyphicon glyphicon-plus" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
Sets the icon to be used on an expandable tree node.
#### highlightSearchResults
Boolean. Default: true
Whether or not to highlight search results.
#### highlightSelected
Boolean. Default: true
Whether or not to highlight the selected node.
#### levels
Int
没有合适的资源?快使用搜索试试~ 我知道了~
php网盘系统/云存储个人网盘源码/仿百度云盘源码
共1980个文件
js:906个
html:347个
png:187个
需积分: 8 27 下载量 61 浏览量
2023-03-22
12:14:35
上传
评论 3
收藏 11.2MB ZIP 举报
温馨提示
php网盘系统/云存储个人网盘源码/仿百度云盘源码 这是一套基于PHP MYSQL的网盘系统,php云存储个人网盘源码,仿百度云盘源码,提供文件的网络备份,同步和分享效劳。支持断点续传,秒传等功用。 可选择文件下载到本地或者在线珍藏;回收站功用避免用户误删数据;云存储的不二之选。 装置阐明: 直接上传运转域名即可自动装置
资源推荐
资源详情
资源评论
收起资源包目录
php网盘系统/云存储个人网盘源码/仿百度云盘源码 (1980个子文件)
ZeroClipboardPdf.as 9KB
ZeroClipboard.as 6KB
.bowerrc 43B
morris.grid.coffee 12KB
morris.line.coffee 12KB
line_spec.coffee 8KB
set_data_spec.coffee 7KB
label_series_spec.coffee 6KB
morris.donut.coffee 5KB
morris.bar.coffee 5KB
jquery.easy-pie-chart.coffee 5KB
donut_spec.coffee 2KB
hover_spec.coffee 2KB
area_spec.coffee 2KB
parse_time_spec.coffee 2KB
morris.area.coffee 2KB
bar_spec.coffee 2KB
commas_spec.coffee 1KB
colours.coffee 1KB
auto_grid_lines_spec.coffee 1KB
morris.hover.coffee 1KB
morris.coffee 1006B
pad_spec.coffee 588B
y_label_format_spec.coffee 443B
placeholder.coffee 162B
jshint.config 4KB
COPYING 2KB
bootstrap.css 140KB
bootstrap.css 123KB
bootstrap.min.css 121KB
main.css 120KB
bootstrap.min.css 100KB
style.css 80KB
font-awesome-ie7.css 40KB
font-awesome-ie7.min.css 37KB
jquery-ui-1.8.4.custom.css 33KB
jquery-ui-1.8.4.custom.css 33KB
jquery-ui-1.10.1.custom.css 31KB
editor_ie7.css 29KB
editor_iequirks.css 28KB
editor_ie8.css 27KB
video-js.css 27KB
editor_ie.css 27KB
font-awesome.css 27KB
jquery-ui-1.10.1.custom.min.css 26KB
editor_gecko.css 26KB
editor.css 26KB
font-awesome.min.css 22KB
theme.css 20KB
bootstrap-theme.css 19KB
bootstrap-theme.min.css 17KB
dialog_ie7.css 16KB
dialog_ie8.css 16KB
dialog_iequirks.css 16KB
dialog_ie.css 16KB
dialog_opera.css 15KB
video-js.min.css 15KB
dialog.css 15KB
bootstrap-switch.css 14KB
datetimepicker.css 12KB
bootstrap-fullcalendar.css 11KB
demo_table.css 11KB
fullcalendar.css 10KB
dropzone.css 10KB
shCore.css 10KB
index.css 9KB
TableTools.css 9KB
style-responsive.css 9KB
gallery.css 8KB
demo_table_jui.css 8KB
bootstrap-switch-conquer.css 7KB
style-responsive.css 7KB
bootstrap-reset.css 6KB
jasmine.css 6KB
jquery.ui.plupload.css 6KB
shCore.css 6KB
shCore.css 6KB
shCore.css 6KB
shCore.css 6KB
shCore.css 6KB
shCore.css 6KB
screen.css 6KB
doc.css 5KB
doc.css 5KB
doc.css 5KB
doc.css 5KB
doc.css 5KB
doc.css 5KB
xcharts.css 5KB
daterangepicker-bs3.css 5KB
sample.css 5KB
qunit-1.12.0.css 5KB
qunit.css 5KB
jquery.dataTables_themeroller.css 4KB
jquery.dataTables.css 4KB
datepicker.css 4KB
styles.css 4KB
tree-conquer.css 4KB
daterangepicker.css 4KB
jquery.nestable.css 4KB
共 1980 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
网创学长
- 粉丝: 1935
- 资源: 914
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功