bootstrap treeview 增删改查 的正确姿势
来源:互联网 发布:网上卖的淘宝教程没用 编辑:程序博客网 时间:2024/06/05 04:34
划重点:源文件(js和css)存在bug,比如updateNode更新节点的时候,如果更新的节点下面有子节点,则更新过之后,子节点就没了,网上有人已改过了,下载直接覆盖即可,地址:
http://blog.csdn.net/qq812858143/article/details/68945157
以下为转载内容:
我的engineercms中大量使用bootstrap treeview,如果不能实现增删改那只能换成ztree了。不过还是找到了解决方法。
网上的方法都是基于https://github.com/jonmiles原版的treeview,采用在源码中增加方法达到目的,比如:
bootstrap-treeview 扩展 添加多个子节点、删除节点、删除全部子节点 和 惰性加载的应用
bootstrap-treeview 扩展addNode方法 动态添加子节点的方法
bootstrap-treeview 扩展addNode deleteNode方法 动态添加删除子节点的方法
bootstrap-treeview addNode deleteNode editNode 全都奉上
而用google搜索bootstrap treeview addnode,就找到了https://www.npmjs.com/package/patternfly-bootstrap-treeview也就是这个https://github.com/patternfly/patternfly-bootstrap-treeview,这里实现了增删改的方法。
addNode(nodes, parentNode, index, options)
Add nodes to the tree.
$('#tree').treeview('addNode', [ nodes, parentNode, index, { silent: true } ]);
If parentNode evaluates to false, node will be added to root
If index evaluates to false, node will be appended to the nodes
Triggers nodeRendered
event; pass silent to suppress events.
removeNode()
Removes given nodes from the tree.
$('#tree').treeview('removeNode', [ nodes, { silent: true } ]);
updateNode(node, newNode, option)
Updates / replaces a given tree node.
$('#tree').treeview('updateNode', [ node, newNode, { silent: true } ]);
Triggers nodeRendered
event; pass silent to suppress events.
当然,还有其他非常好的方法,比如父子孙节点联动。
hierarchicalCheck
Boolean. Default: false
Whether or not to enable hierarchical checking/unchecking of checkboxes.
propagateCheckEvent
Boolean. Default: false
Whether or not to propagate nodeChecked and nodeUnchecked events to the parent/child nodes, used in conjunction with hierarchicalCheck.
这里的坑,就是nodeid已经不是一个数字,旧版的nodeid是将展开后的tree从上往下排序,1代表最上面那个节点,以此类推。而新的变成了,0.0或者1.0.0.0类似这样的,分别表示第一个一级目录的第一个节点,第二个一级目录下的第三级目录的第一个节点。位数代表分级,数字代表序号。向选中的节点下添加子节点
- bootstrap treeview 增删改查 的正确姿势
- bootstrap treeview 增删改的正确姿势
- Bootstrap 增删改查
- Entity_Framework的增删改查,以及绑定GridView和TreeView
- jqery easyui 利用treeview实现菜单的增删改查
- Bootstrap增删改查,应用treeview,addTabs,table,bootbox,datatimepicker,fileinput
- 【BootStrap】--具有增删改查功能的表格Demo
- 【BootStrap】--具有增删改查功能的表格Demo
- 【BootStrap】--具有增删改查功能的表格Demo
- 【BootStrap】--具有增删改查功能的表格Demo
- bootstrap-table 实现表格增删改查
- 关于bootstrap-treeview数型结构的转化及使用、增删改等操作
- 引用bootstrap图标的正确姿势
- datagridview的增删改查
- jdbc的增删改查
- GridView 的增删改查
- 联系人的增删查改
- 数据库的增删改查
- iOS 音视频之网络视频播放AVPlayerViewController(iOS8.0+使用)
- Latex写论文中,算法过长,需要分页显示的方法
- SDUT-3403 数据结构实验之排序六:希尔排序
- (Tensorflow+python)张量、会话、向前传播
- 1421 整数转字符串(递归)
- 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与风投