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.示例图
随机推荐
- Sea.Js的运行原理(转)
1.CMD(Common Module Definition)规范 Sea.js采用了和Node相似的CMD规范,使用require.exports和module来组织模块.但Sea.js比起Node ...
- 用cas来实现php的单点登陆
最近项目中需要做单点登录,客户端包含Java.ruby和PHP,java有几个应用程序,php是discuz+supesite+ucenter,配置步骤如下: 1.cas服务端:下载地址:http:/ ...
- NPOI 2.0 教程(二):编辑既存的EXCEL文件
NPOI 2.0 教程(二):编辑既存的EXCEL文件 分类: C#技术 2014-03-11 15:40 993人阅读 评论(3) 收藏 举报 c#excelNPOI 转载请注明出处 http:// ...
- 当浏览器窗体改变时,div跟着变动方法
$(function(){ resizeU(); $(window).resize(resizeU); }); function resizeU() { var divkuangH = $(windo ...
- VLAN及Trunk实验
VLAN及Trunk实验 一 基本VLAN试验 实验拓扑: 实验目的:掌握VLAN基本配置 掌握静态接口VLAN划分 实验需求:在交换机switch上面创建两个VLAN,vlan2和vlan3,vla ...
- Segment,Path,Ring和Polyline对象
Segment几何对象 Segment对象是一个有起点和终点的“线“,也就是说Segement只有两个点,至于两点之间的线是直的,还是曲的,需要其余的参数定义.所以Segment是由起点,终点和参 ...
- jquery has deprecated synchronous XMLHTTPRequest
Like many others, my website is using jquery. When I open the developer tools, I see a warning that ...
- gen_create_syn.sql
set echo off feedback off verify off pagesize 0 linesize 120 ---变量从 sqlplus 的 call代码 传递过来 . -- 1 表示连 ...
- FACE++学习二、获得face属性
http://blog.csdn.net/lyq8479/article/details/17362685 为了防止网页丢失还是自己保存一份安全一点 人脸检测API介绍 在Face++网站的“API文 ...
- UILabel 解析及自适应
CGFloat width1=[(NSString *)ob1 sizeWithFont:[UIFont systemFontOfSize:16] constrainedToSize:CGSizeMa ...