Results 1 to 3 of 3

Thread: Selectionchange is fired on tree list destroy

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257

    Default Selectionchange is fired on tree list destroy

    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  2. #2
    Sencha User
    Join Date
    Nov 2015
    Location
    Paris
    Posts
    34

    Default

    Quote Originally Posted by evant View Post
    Same here.
    I lost a pair of hours trying to understand what happened.

    treelist.updateSelection() is fired, but I would expect !me.destroying to prevent this issue, but me.destroying is false, I don't understand why :

    Code:
     updateSelection: function(selection, oldSelection) {
            var me = this,
                item,
                parent;
     
            if (!me.destroying) {
    // getItem has guards around null, so we don't 
    // need to check for oldSelection/selection here 
                item = me.getItem(oldSelection);
                if (item) {
                    item.setSelected(false);
                }
     
                item = me.getItem(selection);
                if (item) {
                    item.setSelected(true);
     
                    while (parent = item.getParentItem()) {
                        parent.setExpanded(true);
                        item = parent;
                    }
                }
                me.fireEvent('selectionchange', me, selection);
            }
        },
    If someone has a workaround/override, it would be great to share it.

  3. #3
    Sencha Premium User suzuki1100nz's Avatar
    Join Date
    Apr 2011
    Location
    New Zealand
    Posts
    716

    Default

    The issue was introduced by a code change to the Ext.list.Tree destroy() method.
    Previous versions set me.destroying = true; before setting selection to null and clearing store etc....
    This was done as the callParent() method was last in the list and its the callParent() that normally does the work of setting isDestroying and destroying flag and initiating the doDestroy() process which results in destroyed being set.

    Work around is to create an override of the "Ext.list.Tree" class and redefine the destroy method as below.


    Code:
    destroy: function () {
        var me = this;
    
    
        me.destroying = true;  // normally set in callParent 
    
    
        me.unfloatAll(); 
        me.activeFloater = null;
        me.setSelection(null);
        me.setStore(null);
        me.callParent();
    },

Similar Threads

  1. Replies: 1
    Last Post: 6 Jul 2015, 2:47 PM
  2. Replies: 7
    Last Post: 25 Mar 2013, 2:21 PM
  3. [FIXED] [2.0.1rc] List event selectionchange now has incorrect parameters, fired more often
    By welshcathy in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 11 Apr 2012, 12:10 PM
  4. list selectionChange event fired before button handler
    By youmi in forum Sencha Touch 1.x: Q&A
    Replies: 2
    Last Post: 10 Jan 2012, 2:42 PM
  5. [OPEN] [FIXED]selectionchange event is fired twice
    By steffenk in forum Ext:Bugs
    Replies: 5
    Last Post: 20 Feb 2011, 6:20 PM

Posting Permissions

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