EXT JS custom TreeNodeUI or XTemplate

I am looking for a way to get a custom template for a node in a TreePanel .. I would like to wrap it in a div or something like that. Can anyone help?

+3
source share
1 answer

There seem to be two ways to implement a custom TreeNodeUI. First, add your implementation to the uiProviders list and assign a property to your nodes named "uiProvider" with the value of the generated key:

var loader = new Ext.tree.TreeLoader({
    uiProviders: {
        myKey: My.TreeNodeUI.Implementation
    }
});

This will only change the tree nodes that have the uiProvider property set, leaving the remaining nodes unchanged!

ALL TreeNodeUI, createNode, node, ( Ext.tree.TreeNode). TreeNode, uiProviders.

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
    } 
});
+4

Source: https://habr.com/ru/post/1767557/


All Articles