How to set an item selected in extjs tree panel by default?

Anand Singh picture Anand Singh · Jul 24, 2013 · Viewed 10k times · Source

I have a tree panel with some items. Whenever I render the treepanel an item should be selected by default.

Answer

Renganathan M G picture Renganathan M G · Jul 24, 2013

Please refer this code. This will work

Ext.each(Nodes, function(item, index, allNodes)
{
    var rec = TreePanelObj.getView().getRecord(item);
    if() //any condition 
    {
        TreePanelObj.getSelectionModel().select(index);
    }
});