更改 node.attributes 后如何渲染 TreeNode?
How to render TreeNode after changing node.attributes?
我正在更新 Ext.tree.AsyncTreeNode 的属性。更新后,我想在 UI 上呈现更新后的值。此节点已呈现,如何使用新更新的属性值重新呈现相同的 treeNode?
我正在为 TreeNode 使用 uiProvider 即 attr.uiProvider = Ext.ux.tree.TreeGridNodeUI
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;
}
}
我正在更新 Ext.tree.AsyncTreeNode 的属性。更新后,我想在 UI 上呈现更新后的值。此节点已呈现,如何使用新更新的属性值重新呈现相同的 treeNode?
我正在为 TreeNode 使用 uiProvider 即 attr.uiProvider = Ext.ux.tree.TreeGridNodeUI
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;
}
}