bootstrap treeview 下拉树
来源:互联网 发布:网上卖的淘宝教程没用 编辑:程序博客网 时间:2024/06/07 08:53
说明:数据一次性加载,适合数据量不是很大的场景
引用文件:bootstrap treeview及其css,推荐下载地址:http://blog.csdn.net/qq812858143/article/details/68945157
<script type="text/javascript" src="<%=path%>/bootstrap/treeView/bootstrap-treeview.js"></script><link rel="stylesheet" href="<%=path%>/bootstrap/treeView/bootstrap-treeview.min.css" type="text/css"/>
JS: $(function () { getTree('1'); }) function buildTree(parentNode, datas) { for (var key in datas) { var data = datas[key]; if (data.parentid == parentNode.id) { var node = {text: data.knowledgeText, id: data.id, nodes: [], selectable: true}; parentNode.nodes.push(node); buildTree(node, datas); } } if (parentNode.nodes.length == 0) { delete parentNode.nodes; } } function getTree(strid) { var params = {}; params.id = 'a696ee80-5b26-4a99-b013-ba22bec4d3bb'; $.ajax({ url: "/knowledge/getTree", // 请求的URL dataType: 'json', type: "get", data: params, success: function (data) { var tree = {text: '复读语文', id: 'a696ee80-5b26-4a99-b013-ba22bec4d3bb', nodes: []}; buildTree(tree, data.data); $('#knowledgeTree').treeview({ color: "#428bca", data: [tree],// showCheckbox: true onNodeSelected: function (event, mdata) { $("#knowledgeText").val(mdata.text); $("#hideDiv").hide(); } }); } }); }
<body><input type="text" id="knowledgeText" name="knowledgeText" class="form-control" value="" onclick="$('#hideDiv').show()" placeholder="分类名称"/><div id="hideDiv" style="display: none;"> <div id="knowledgeTree"></div> <button class="btn btn-danger" type="button" onclick=""> <span class="glyphicon glyphicon-eye-open"></span> 确定 </button></div></body>
阅读全文
0 0
- bootstrap treeview 下拉树
- bootstrap treeview 下拉树 (二) checkBox多选
- 树控件--bootstrap treeview
- bootstrap-treeview
- bootstrap-treeview
- bootstrap-treeview
- bootstrap-treeview
- bootstrap-treeview 树列表 总结整理
- 基于bootstrap的jQuery bootstrap-treeview 多级列表树插件
- bootstrap input 下拉树 下拉菜单 下拉列表
- bootstrap下拉
- bootstrap-treeview 前台使用
- Bootstrap-treeview使用API
- bootstrap-treeview用法总结
- bootstrap-treeview简单使用
- bootstrap-treeview 中文api
- bootstrap-treeview 前台使用
- bootstrap-treeview参数详解
- Spring取得*.properties文件属性
- The Python Tutorial(1)- Python教程
- python3 实现12306查询余票
- Knight Probability in Chessboard
- 骨牌覆盖
- bootstrap treeview 下拉树
- hello everybody, my name is harmful, i am so excite.
- IT与风投
- Linux服务器安装SVN总结
- 图的最短路
- 【计算几何】【UVA 12304】2D Geometry 110 in 1!
- View事件传递与绘制机制,自定义View实现理解
- 提交方式post
- Android jni开发-3(jni函数详解)