如何动态更换图标

我有个树的组件,我想根据某个条件来动态的修改被选中的节点的图标,我试了很多方法,都不行,没有办法了,求 救

我查看了api确实没有像对应的方法,只有setText(),因为这个图标都是在组建生成的时候一起生成的,不过你可以通过另个变态一点的方法解决

[code="js"]treePanel.on('click',function(n){
n.getUI().getIconEl().src = '../../images/icons/checked.png';
});[/code]
节点有下列方法
getUI() : TreeNodeUI
Returns the UI object for this node. //返回这个节点的UI对象

然后你去看TreeNodeUI的api
他里面提供了两个方法
getIconEl() : HtmlElement 获得图片的那个对象
Returns the icon element.
Parameters:

* None.

Returns:

* HtmlElement
  The DOM image element.

getTextEl() : HtmlNode 这个获得文本的那个对象
Returns the text node.

Parameters:

* None.

Returns:

* HtmlNode
  The DOM text node.

然后你就可以通过图片的src属性来动态改变图片了