EXT JS custom TreeNodeUI or XTemplate
I'm looking for a way to get a custom template for a node in TreePanel .. i would like to wrap it in a div or something开发者_运维问答 like that. Can abybody help ?
It looks as though there are two ways to implement a custom TreeNodeUI. The first is to add your implementation to the list of uiProviders, and assign a property to your nodes called 'uiProvider' with a value of the key you created:
var loader = new Ext.tree.TreeLoader({
uiProviders: {
myKey: My.TreeNodeUI.Implementation
}
});
This will only change tree nodes that have the uiProvider property set, leaving other nodes unchanged!
If you want to change ALL TreeNodeUIs, you can override the createNode method to create whichever type of node you like (though this should extend Ext.tree.TreeNode). If you don't want to implement a whole TreeNode class, you can, again, just override the uiProviders attribute.
var loader = new Ext.tree.TreeLoader({
//override the CreateNode function
createNode: function(attr) {
attr.uiProvider = My.TreeNodeUI.Implementation
return Ext.tree.TreeLoader.prototype.createNode.call(this, attr);
//or possibly...
//return My.CreateNode.Implementation
}
});
精彩评论