Results 1 to 3 of 3

Thread: Tree selection doen't work after 'id' was changed on the server

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-14432 in 5.0.2.
  1. #1
    Sencha Premium Member
    Join Date
    Nov 2010
    Posts
    53

    Default Tree selection doen't work after 'id' was changed on the server

    Ext version tested:
    • Ext 5.0.1.1206
    Browser versions tested against:
    • Chrome 31
    • IE11
    Description:
    • The problem is similar to another one http://www.sencha.com/forum/showthre...08#post1055508 but applies to the tree.
    • It is only happens when you have a binding in a view like this:
      Code:
      {
          // a button
          text: 'Delete',
          bind: {
              disabled: '{!userstree.selection}'
          }
      }
    • The problem can be seen in [Ext.data.NodeInterface] class:
      Code:
      callJoined: function (funcName, args) {
        // 1. After id changed: args = ['Fiddle.model.User-1', '123'], 123 - is the new id
      
      
        this.callParent([funcName, args]);  
        // 2. After this method ^ args are broken (modifed): [rec, 'Fiddle.model.User-1', '123']
        // because of args.unshift(me) in parent's method
        
        this.callTreeStore(funcName, args); 
        // it makes it again: (args || (args = [])).unshift(this) so args become [rec, rec, 'Fiddle.model.User-1', '123']
        // and these args are not what Ext.data.Store onIdChanged method expect. 
      }
    • The solution that I see is to make args atomic: use args.slice() before each unshift both in Ext.data.Model.callJoined and Ext.data.NodeInterface.callTreeStore.
    Steps to reproduce the problem:
    The result that was expected:
    • array of 1 selected element in 'selectionchange' event
    The result that occurs instead:
    • array of 2 elements in 'selectionchange' event

  2. #2
    Sencha Premium Member
    Join Date
    Nov 2010
    Posts
    53

    Default

    Temporary fix

    Code:
    Ext.define('Ext.bugfix.data.NodeInterface', {
        override: 'Ext.data.NodeInterface',
    
    
        statics: {
            getPrototypeBody: function () {
                var result = this.callParent(arguments);
                result.privates.callJoined = this.overrides.callJoined;
                return result;            
            },
    
    
            overrides: {
                callJoined: function (funcName, args) {
                    args = args || [];
                    this.callParent([funcName, args.slice()]);
                    this.callTreeStore(funcName, args.slice());
                }
            }
        }    
    });

  3. #3
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Posting Permissions

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