Extjs: How to change node tree attributes?

How to change node tree attributes?

One node tree has the following attributes:

{"id":"75", "description":"My Tree Node", "status":"25" "uiProvider":"col", "leaf":true} 

Now my script gets the following data

 { "id":"75", "status":"100", "cls":"done" } 

I am trying to update attributes ( UPDATED ):

 // a.result.data has the new data and taskID is the node id for (var property in a.result.data) { tree.getNodeById(taskID).attributes[property] = a.result.data[property]; } 

However, the tree is not updated.

How can I make a tree show changes? I need node to modify existing attributes and add new attributes.

I appreciate your help!

+4
source share
1 answer

From extjs forums :

 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; } } 

Should work if you call it after the update cycle.

+2
source

All Articles