我查看了api确实没有像对应的方法,只有setText(),因为这个图标都是在组建生成的时候一起生成的,不过你可以通过另个变态一点的方法解决
- treePanel.on('click',function(n){
- n.getUI().getIconEl().src = '../../images/icons/checked.png';
- });
节点有下列方法
getUI() : TreeNodeUI
Returns the UI object for this node. //返回这个节点的UI对象
然后你去看TreeNodeUI的api
他里面提供了两个方法
getIconEl() : HtmlElement 获得图片的那个对象
Returns the icon <img> element.
Parameters:
* None.
Returns:
* HtmlElement
The DOM image element.
-------------------------------------------------
getTextEl() : HtmlNode 这个获得文本的那个对象
Returns the text node.
Parameters:
* None.
Returns:
* HtmlNode
The DOM text node.
然后你就可以通过图片的src属性来动态改变图片了