Search code examples
javascriptextjswindowextjs4

Setting the icons of a node in TreePanel


ExtJS 4:

I've created a treepanel. I wanted to set my own icons for its node so I used iconCls property for every node. Its working. But when I expand a node, it returns back to its normal 'Open Folder' icon.

var treeObject = {
text: "BANK OF AMERICA 1",
cls: "enterprise",
children: [
    {
        text: "core outputs",
        cls: "businessUnit",
        iconCls: 'abc'
    }
],
iconCls: 'abc',
leaf: "false",
expanded: true,
type: "enterprise"
}
treePanel.setRootNode(treeObject);

Please suggest something to avoid this problem.


Solution

  • try to specify your css class like this to prevent override with the default classes of extjs

    .x-grid-tree-node-expanded .x-tree-icon-parent.abc{
      background: url(abc) x y no-repat !important;
    }