BootStrap TreeView使用示例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/Scripts/bootstrap/css/bootstrap-treeview.css" rel="stylesheet"> <script src="/Scripts/bootstrap/js/jquery.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap/js/bootstrap-treeview.js" type="text/javascript"></script> </head>
<body>
<div id="tree"></div> <input type="button" id="btn" value="查询" /> <script type="text/javascript">
$(function () {
function getTree() {
// Some logic to retrieve, or generate tree structure var data = [{
text: "p1",
nodes: [{ text: "p1-1", id: '00001', nodeId: '00001' }, { text: "p1-2", id: '00002' }, { text: "p1-3", id: '00003' }, { text: "p1-4", id: '00004', nodes: [{ text: 'p1-1-1', id: '00005'}]}] }]
return data;
}
var obj = {};
obj.text = "123";
$('#tree').treeview({
data: getTree(), // data is not optional
levels: 5,
multiSelect: true }); $("#btn").click(function (e) { var arr = $('#tree').treeview('getSelected'); alert(JSON.stringify(arr));
for (var key in arr) {
alert(arr[key].id);
} }) }) </script>
</body>
</html>
弹窗口+树形菜单
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link href="/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/Scripts/bootstrap/css/bootstrap-treeview.css" rel="stylesheet"> <script src="/Scripts/bootstrap/js/jquery.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap/js/bootstrap-treeview.js" type="text/javascript"></script>
</head>
<body> <p id="c"></p> <!-- 按钮触发模态框 -->
<button class="btn btn-primary btn-lg" data-toggle="modal"
data-target="#myModal">
开始演示模态框
</button> <!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">
模态框(Modal)标题
</h4>
</div>
<div class="modal-body">
<div id="tree"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary" id="btn">
提交更改
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div> <script type="text/javascript">
$(function () {
function getTree() {
// Some logic to retrieve, or generate tree structure var data = [{
text: "p1",
nodes: [{ text: "p1-1", id: '00001', nodeId: '00001' }, { text: "p1-2", id: '00002' }, { text: "p1-3", id: '00003' }, { text: "p1-4", id: '00004', nodes: [{ text: 'p1-1-1', id: '00005'}]}] }]
return data;
}
var obj = {};
obj.text = "123";
$('#tree').treeview({
data: getTree(), // data is not optional
levels: 5,
multiSelect: true }); $("#btn").click(function (e) { var arr = $('#tree').treeview('getSelected'); for (var key in arr) {
c.innerHTML = c.innerHTML + "," + arr[key].id;
} }) }) </script>
</body>
</html>
BootStrap TreeView使用示例的更多相关文章
- Bootstrap treeview增加或者删除节点
参考(AddNode: http://blog.csdn.net/qq_25628235/article/details/51719917,deleteNode:http://blog.csdn.ne ...
- 初始化bootstrap treeview树节点
最近在做启明星图库时,使用了Jquery Bootstrap Treeview插件.但是,遇到了一个初始化的问题.先看效果如下: 当用户打开图库时,左边分类第一个类别是“所有分类”,默认需要选中. ...
- bootstrap treeview 树形数据生成
这个问题还是挺经典的,后台只是负责查出所有的数据,前台js来处理数据展示给treeview;show you the code below:<script> $(function () { ...
- bootstrap treeview实现菜单树
本博客,介绍通过Bootstrap的treeview插件实现菜单树的功能. treeview链接:http://www.htmleaf.com/Demo/201502141380.html ORM框架 ...
- 在vue-cli项目中使用bootstrap的方法示例
在一个html页面中加入bootstrap是很方便,就是一般的将css和js文件通过Link和Script标签就行. 那么在一个用vue-cli生成的前端项目中如何加入?因为框架不一样了,略微要适应一 ...
- Bootstrap 实现CRUD示例及代码
https://github.com/wenzhixin/bootstrap-table-examples/blob/master/crud/index.html <!DOCTYPE html& ...
- Bootstrap Table 使用示例及代码
http://issues.wenzhixin.net.cn/bootstrap-table/ <!DOCTYPE html> <html> <head> < ...
- Bootstrap导航栏示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- Bootstrap 表单示例
1.打开https://getbootstrap.com/docs/4.3/examples/checkout/复制表单源码 2.清空main标签内容 3.粘贴表单源码 4.示例图
随机推荐
- bash报错./mq.sh: line 15: warning: here-document at line 10 delimited by end-of-file (wanted `eof')
[root@localhost tmp]# ./mq.sh./mq.sh: line 15: warning: here-document at line 10 delimited by end-of ...
- 利用transform制作幻灯片
html代码 <html><head></head><body><div class='hpic'> <ul style=" ...
- UIImage将图片写入本地相册
UIImageWriteToSavedPhotosAlbum(<#UIImage *image#>, <#id completionTarget#>, <#SEL com ...
- js变量数组
<html><head lang="en"> <meta charset="UTF-8"> <title>< ...
- GuideActivity.java引导界面:
这是谷歌官方给我们提供的一个兼容低版本安卓设备的软件包,里面包囊了只有在安卓3.0以上可以使用的api. 而viewpager就是其中之一利用它,我们可以做很多事情,从最简单的导航,到页面菜单等等.那 ...
- LINQ To SQL && Lambda 使用方法小结 (转)
1. 查询Student表中的所有记录的Sname.Ssex和Class列.select sname,ssex,class from studentLinq: from s in Students ...
- HDU 5523 Game
坑题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...
- Vasiliy's Multiset
Vasiliy's Multiset time limit per test 4 seconds memory limit per test 256 megabytes input standard ...
- Linux下VNC配置多个桌面和修改密码 不会当系统重启vnc失效
1:vncserver 2:iptables -I INPUT -p tcp --dport 5901 -j ACCEPT 客户端方式 3:iptables -I INPUT -p tcp --d ...
- ruby, gem install 出现网络错误
gem sources #查看目前的源 gem sources --remove https://rubygems.org/ gem sources -a https://ruby.taobao.or ...