Results 1 to 2 of 2

Thread: Ext.tree.Panel node doesn't keep the selection when iconCLs is changed

    Looks like we cannot reproduce this. Please provide another test case to reproduce this issue.
  1. #1
    Sencha User
    Join Date
    Mar 2013
    Vote Rating

    Default Ext.tree.Panel node doesn't keep the selection when iconCLs is changed

    Hi All.
    I'm using ExtJS4 treepanel and I'm getting such a problem:
    when user clicks on a tree node it's icon should be changed. When I try to change the iconCls property, node's selection disappears.

    Ext.onReady(function() {
        var store = Ext.create('', {
            root: {
                text: 'Root',
                expanded: true,
                children: [
                { text: "detention", leaf: true, opened: false },
                { text: "homework", expanded: true, opened: false, children: [
                    { text: "book report", leaf: true, opened: false },
                    { text: "alegrbra", leaf: true, opened: false}
                ] },
                { text: "buy lottery tickets", leaf: true, opened: false }
        var tree = Ext.create('Ext.tree.Panel', {
    store: store,
            width: 250,
            height: 300,
            renderTo: document.body,
            listeners: {
                itemclick: function(view) {
                    var selectedNode = view.getSelectionModel().getSelection()[0];
                    var icon = '';
                    if ( === true) {
                        icon = 'folder-closed-16';
                        selectedNode.set('opened', false);
                    else {
                        icon = 'folder-opened-16';
                        selectedNode.set('opened', true);
                    selectedNode.set('iconCls', 'x-tree-node-icon ' + icon);
    Note, that if I remove the call to selectedNode.set(), selection is kept but the iconCls is not changed.

    Is there any workaround/fix for this? Is it an Ext bug or am I doing something wrong?
    Thank You.

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    This was fixed in 4.1.2 and is also in the newly released 4.2.0 GA
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts