如何更改树节点的属性?
{"id":"75",
"description":"My Tree Node",
"status":"25"
"uiProvider":"col",
"leaf":true}
现在我的脚本收到以下数据
{
"id":"75",
"status":"100",
"cls":"done"
}
我尝试更新属性(UPDATED):
// a.result.data has the new data and taskID is the node's id
for (var property in a.result.data)
{
tree.getNodeById(taskID).attributes[property] = a.result.data[property];
}
但是,树不会更新.
我感谢您的帮助!
解决方法:
function refreshNodeColumns(n)
{
var t = n.getownerTree();
var a = n.attributes;
var cols = t.columns;
var el = n.ui.getEl().firstChild; // <div class="x-tree-el">
var cells = el.childNodes;
//<div class="x-tree-col"><div class="x-tree-col-text">
for(var i = 1, len = cols.length; i < len; i++)
{
var d = cols[i].dataIndex;
var v = (a[d]!=null)? a[d] : '';
if (cols[i].renderer) v = cols[i].renderer(v);
cells[i].firstChild.innerHTML = v;
}
}
如果你在更新循环后调用它应该工作.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。