bootstrap-tree 动态修改节点遇到的问题

在使用Bootstrap Tree组件时,遇到动态增加或删除节点导致节点ID不断扩大的问题,每次操作后节点都会刷新,影响了对特定节点的正确选择。目前的临时解决方案并不理想,寻求更好的处理方法。
摘要由CSDN通过智能技术生成

在js文件中加入了网上找到的增删方法后出现的问题:

Tree.prototype.addNode = function(identifiers, options) {
		this.forEachIdentifier(identifiers,options,
			$.proxy(function(node, options) {
					this.setAddNode(node, options);
				},
				this));
//*********************************************************
		this.setInitialStates({ nodes: this.tree }, 0);
//**********************************************************

		this.render();
	}

星号包围的地方导致重新加载节点,节点每增加或减少都会刷新导致id不断扩大

因此本来点击获取到的节点id也不准确了

Tree.prototype.setInitialStates = function (node, level) {

		if (!node.nodes) return;
		level += 1;

		var parent = node;
		var _this = this;
		$.each(node.nodes, function checkStates(index, node) {
//****************************************************************
			// nod
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值