通过梅花雪大哥 提供的remove 功能我写了一个edit方法
MzTreeView.prototype.editNode = function(id,name)
{
var d = this.divider, _d = this._d
var reg = new RegExp("(^|"+ _d +")([^"+d+"]+"+d+id+")("+ _d +"|$)", "g");
var a = this.names.match(reg);
if(a)
{
for(var i=0;i<a.length;i++)
{
var sourceNode = this.nodes[a[i].replace(new RegExp(_d, "g"), "")];
var clientId = this.getAttribute(sourceNode, "index");
if(clientId)
{
this.node[clientId].text = name;
//this.load(this.node[clientId].parentId);
this.buildNode(this.node[clientId].parentId);
this.node[this.node[clientId].parentId].isLoad = false;
this.expand(this.node[this.node[clientId].parentId].id, false);
}
}
}
}
修改的是可以显示,但原来的并没有替换 还显示.
请各位高手 前辈帮帮小弟!!!
MzTreeView.prototype.editNode = function(id,name)
{
var d = this.divider, _d = this._d
var reg = new RegExp("(^|"+ _d +")([^"+d+"]+"+d+id+")("+ _d +"|$)", "g");
var a = this.names.match(reg);
if(a)
{
for(var i=0;i<a.length;i++)
{
var sourceNode = this.nodes[a[i].replace(new RegExp(_d, "g"), "")];
var clientId = this.getAttribute(sourceNode, "index");
if(clientId)
{
this.node[clientId].text = name;
//this.load(this.node[clientId].parentId);
this.buildNode(this.node[clientId].parentId);
this.node[this.node[clientId].parentId].isLoad = false;
this.expand(this.node[this.node[clientId].parentId].id, false);
}
}
}
}
修改的是可以显示,但原来的并没有替换 还显示.
请各位高手 前辈帮帮小弟!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货