1. #1
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default [2.0rc1][SOLVED][DUP] Ext.DataView, refreshNode, updateIndexes

    [2.0rc1][SOLVED][DUP] Ext.DataView, refreshNode, updateIndexes


    seems to be a bug with Ext.DataView::updateIndexes when calling Ext.DataView::refreshNode on the *first* record in store (ie: index 0);

    this code was called upon a View with just 1 record.

    firebug says:
    Code:
    ns[i] has no properties
    updateIndexes(0, true)CompanyView.js (line 120)  // <-- note 2nd param, endIndex, in particular
    onUpdate(Object data=[1] baseParams=Object paramNames=Object, Object id=1 data=Object json=[5] store=Object fields=[5])ext-all-debug.js (line 17391)
    refreshNode(0)ext-all-debug.js (line 17420)
    (no name)(Object labelAlign=right buttons=[3] items=[6], Object form=Object options=Object response=Object)CompanyView.js (line 140)
    fire()ext-all-debug.js (line 1504)
    fireEvent()ext-all-debug.js (line 1201)
    afterAction(Object form=Object options=Object response=Object, true)ext-all-debug.js (line 27264)
    success(Object tId=16 status=200 statusText=OK)ext-all-debug.js (line 28618)
    apply(function(), Object form=Object options=Object response=Object, [Object tId=16 status=200 statusText=OK, Object scope=Object timeout=30000], undefined)ext-base.js (line 9)
    handleResponse(Object tId=16 status=200 statusText=OK)ext-all-debug.js (line 5203)
    getViewWidth(Object conn=XMLHttpRequest tId=16, Object scope=Object argument=Object timeout=30000, undefined)ext-base.js (line 10)
    getViewWidth()
    Next, I override Ext.DataView::refreshIndexes() and throw in some console.logs:
    Code:
     view.updateIndexes = function(startIndex, endIndex){
         var ns = this.all.elements;
         startIndex = startIndex || 0;
         
         console.log('endIndex here: ', endIndex);
    
          endIndex = (endIndex || endIndex === 0) || (ns.length - 1);
    
          console.log('updateIndexes: startIndex: ', startIndex, ', endIndex: ', endIndex);
    
           for(var i = startIndex; i <= endIndex; i++){
                console.log('i: ', i);
                 ns[i].viewIndex = i;
            }
        };
    Here's the result of the console.logs:
    Code:
    endIndex here:  0
    updateIndexes: startIndex: 0 , endIndex: true
    i: 0
    i: 1

  2. #2
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default the problem is certainly here:

    the problem is certainly here:


    the bug is certainly here:

    Code:
    endIndex = (endIndex || endIndex === 0) || (ns.length - 1);
    how 'bout this instead?
    Code:
    endIndex = ( endIndex === 0 || endIndex < ns.length) ? endIndex : ns.length -1;

  3. #3
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    already reported earlier in this thread:
    http://extjs.com/forum/showthread.php?t=16847

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,445
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Bug resolved in SVN Revision 1411.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 2