Results 1 to 10 of 32

Thread: [4.0.0] Bug in AbstractView.updateIndexes

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,019
    Vote Rating
    106
      0  

    Default [4.0.0] Bug in AbstractView.updateIndexes

    Hi,

    Believe I've found an issue in updateIndexes.
    It's seems to be getting called when calling removeAll on a tree node, during a load (when clearOnLoad is true).

    Anyway, code:
    PHP Code:
        updateIndexes : function(startIndexendIndex) {
            var 
    ns this.all.elements,
                
    records this.store.getRange();
            
    startIndex startIndex || 0;
            
    endIndex endIndex || ((endIndex === 0) ? : (ns.length 1));
            for(var 
    startIndex<= endIndexi++){
                
    ns[i].viewIndex i;
                
    ns[i].viewRecordId records[i].internalId;
                if (!
    ns[i].boundView) {
                    
    ns[i].boundView this.id;
                }
            }
        }, 
    The issue is that sometimes records[i] is outside of the bounds of the collection.
    Not entirely sure why, or what this method is meant to be doing, but it could probably be a bit more defensive I think.

    Cheers,
    Westy

  2. #2
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    10
      0  

    Default

    I've seen this once before, and I can't remember how I got around it - but if ns (this.all.elements) has length 0, and both startIndex and endIndex are 0, that would happen...

  3. #3
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,019
    Vote Rating
    106
      0  

    Default

    I'm generally seeing it on the last child node... have kind of worked around it for now, but it's leaves the UI in a mess.

    Basically overridden my tree view's updateIndexes, and put a try..catch around callParent; meaning I get nodes staying in the tree, but at least I can keep testing, which is sufficient for my current focus.

    Cheers

  4. #4
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,019
    Vote Rating
    106
      0  

    Default

    My override for the moment:
    PHP Code:
        updateIndexes : function(startIndexendIndex) {
            var 
    ns this.all.elements,
                
    records this.store.getRange();
            
    startIndex startIndex || 0;
            
    endIndex endIndex || ((endIndex === 0) ? : (ns.length 1));
            for(var 
    startIndex<= endIndexi++){
                
    ns[i].viewIndex i;
                
    ns[i].viewRecordId records.length >= records[i].internalId undefined;
                if (!
    ns[i].boundView) {
                    
    ns[i].boundView this.id;
                }
            }
        }, 
    But I suspect there's some underlying problem causing this.store.getRange to not return a set that matches this.all.elements length.

    Cheers,
    Westy

  5. #5
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    10
      0  

    Default

    There are definitely some things that are in need of null and range checking...

    stevil

  6. #6
    Ext JS Premium Member
    Join Date
    Nov 2010
    Location
    Rudolstadt, Germany
    Posts
    52
    Vote Rating
    0
      0  

    Default

    Hello,
    I have also an issue with AbstractView.updateIndexes / reloading a TreeStore.

    I discovered a problem when reloading a TreeStore quick successive order.
    Here is my store configuration:

    PHP Code:
    Ext.define('Rekuma.store.Reseller.Tree', {
        
    extend'Ext.data.TreeStore',
        
    model'Rekuma.model.TreeNode',
        
    autoLoadtrue,
        
    clearOnLoadtrue,
        
    proxy:  {
                    
    type'ajax',
                    
    url 'menu/reseller',
                    
    actionMethods: {
                        
    read   'POST'
                    
    },
                    
    extraParams: {
                        
    category'reseller'
                    
    }
                }
            }
        ); 
    This is what I do in my controller:
    PHP Code:
    Ext.define('Rekuma.controller.Navigation', {
        
    extend'Ext.app.Controller',
        
    views: [
            
    'navigation.PrimaryTreePanel'
        
    ],
        
    stores: [
            
    'Reseller.Tree'
        
    ],
        
    init: function() {

            
    this.control({
                
    'viewport > panel > primarytreepanel': {
                    
    selectionchangethis.selectionChanged
                
    },
                
    'viewport > panel > primarytreepanel > toolbar > button': {
                    
    clickthis.refresh
                
    }
            });
        },
        
    selectionChanged: function (viewselections){
        },
        
    refresh: function() {
            
    this.getResellerTreeStore().load();
        }
    }); 
    Everything works fine as long as I press the refresh button slowly.
    If I load the store in a quick, successive order, I get the message:
    Code:
    TypeError: Result of expression 'records[i]' [undefined] is not an object. AbstractView.js:492
    Also, I see TreeNodes twice.
    I get the same behavior on every click, if I set clearOnLoad: false

    Stefan

  7. #7
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,019
    Vote Rating
    106
      1  

    Default

    Quote Originally Posted by westy View Post
    My override for the moment:
    PHP Code:
        updateIndexes : function(startIndexendIndex) {
            var 
    ns this.all.elements,
                
    records this.store.getRange();
            
    startIndex startIndex || 0;
            
    endIndex endIndex || ((endIndex === 0) ? : (ns.length 1));
            for(var 
    startIndex<= endIndexi++){
                
    ns[i].viewIndex i;
                
    ns[i].viewRecordId records.length >= records[i].internalId undefined;
                if (!
    ns[i].boundView) {
                    
    ns[i].boundView this.id;
                }
            }
        }, 
    But I suspect there's some underlying problem causing this.store.getRange to not return a set that matches this.all.elements length.

    Cheers,
    Westy
    Whoops, bug in this.

    Fixed:
    PHP Code:
        updateIndexes : function(startIndexendIndex) {
            var 
    ns this.all.elements,
                
    records this.store.getRange();
            
    startIndex startIndex || 0;
            
    endIndex endIndex || ((endIndex === 0) ? : (ns.length 1));
            for(var 
    startIndex<= endIndexi++){
                
    ns[i].viewIndex i;
                
    ns[i].viewRecordId = ((records.length i) && records[i]) ? records[i].internalId undefined;
                if (!
    ns[i].boundView) {
                    
    ns[i].boundView this.id;
                }
            }
        }, 

  8. #8
    Sencha User
    Join Date
    Mar 2010
    Posts
    41
    Vote Rating
    0
      0  

    Default

    I am still getting this error in 4.0.2. Your fix seems to work great (as I am no longer getting errors in my console window). Are the Sencha team aware of this?

Similar Threads

  1. Replies: 2
    Last Post: 26 Nov 2007, 5:40 PM
  2. Replies: 3
    Last Post: 17 Nov 2007, 9:27 AM

Posting Permissions

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