Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Ext JS Premium Member simeon's Avatar
    Join Date
    Mar 2007
    Location
    Austin, Texas
    Posts
    227
    Vote Rating
    1
    simeon is on a distinguished road

      0  

    Default DataView does not update the displayed rows correctly

    DataView does not update the displayed rows correctly


    I have a list panel.
    When I load the store it displays properly
    when I call load on the store a second time with a search constraint it returns less records.

    The doRefresh method has a bug in it that results in the displayed results being the html from the previous list.

    Code:
    doRefresh: function(me) {
            
            var store = me.getStore(),
                records = store.getRange(),
                items = me.getViewItems(),
                recordsLn = records.length,
                itemsLn = items.length,
                deltaLn = recordsLn - itemsLn,
                i, item;
    
            // No items, hide all the items from the collection.
            if (recordsLn < 1) {
                me.onStoreClear();
                return;
            }
    
            // Too many items, hide the unused ones
            if (deltaLn < 0) {
                this.moveItemsToCache(itemsLn + deltaLn, itemsLn - 1);
                //return;
                // Have to comment out the return here or you will never be able to update the ui with a data set smaller then the previous data set. 
            }
            // Not enough items, create new ones
            else if (deltaLn > 0) {
                this.doCreateItems(store.getRange(itemsLn), itemsLn);
            }
    
            // Update Data and insert the new html for existing items
            
            
            //  itemsLn has a length that matches the previous load data set and needs to be items.length
            //  This is the old verison ->   for (i = 0; i < itemsLn; i++) {
            
            // this one works correctly
            for(i=0;i<items.length;i++)
            {
                item = items[i];
                me.updateListItem(records[i], item);
            }
        },

  2. #2
    Ext JS Premium Member simeon's Avatar
    Join Date
    Mar 2007
    Location
    Austin, Texas
    Posts
    227
    Vote Rating
    1
    simeon is on a distinguished road

      0  

    Default


    I finally figured out how to do the overrides correctly when using the auto loader.

    here is my override for this bug.

    Code:
    Ext.define('DataView_OverRide', {
        override:'Ext.dataview.DataView', 
        doRefresh: function(me) {
            
            var store = me.getStore(),
                records = store.getRange(),
                items = me.getViewItems(),
                recordsLn = records.length,
                itemsLn = items.length,
                deltaLn = recordsLn - itemsLn,
                i, item;
    
            // No items, hide all the items from the collection.
            if (recordsLn < 1) {
                me.onStoreClear();
                return;
            }
    
            // Too many items, hide the unused ones
            if (deltaLn < 0) {
                this.moveItemsToCache(itemsLn + deltaLn, itemsLn - 1);            
            }
            // Not enough items, create new ones
            else if (deltaLn > 0) {
                this.doCreateItems(store.getRange(itemsLn), itemsLn);
            }
    
            // Update Data and insert the new html for existing items
    
            for(i=0;i<items.length;i++)
            {
                item = items[i];
                me.updateListItem(records[i], item);
            }
        }
    })

  3. #3
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    21
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    I noticed this as well and it has already been fixed for the next release. Thank you for the report.

Thread Participants: 1