Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-8329 in 4.2.3.
  1. #1
    Ext JS Premium Member GustavR's Avatar
    Join Date
    Jun 2009
    Posts
    37
    Vote Rating
    18
    GustavR will become famous soon enough

      3  

    Default [4.2.0.320] Ext.grid.plugin.BufferedRenderer: Load less data when scrolled down fails

    [4.2.0.320] Ext.grid.plugin.BufferedRenderer: Load less data when scrolled down fails


    REQUIRED INFORMATION
    Ext version tested:
    • Ext 4.2.0.320
    Description:
    When scrolling down in a grid with BufferedRenderer plugin and then reloading the store with a filter (or anything else that results in a much smaller data set), the grid is just emptied (all white), the scroll position stays where it is and no row is rendered, you can scroll up and down all you like with no effect.

    Steps to reproduce the problem:
    • Create grid with the BufferedRenderer plugin
    • Load some huge data (more than 100 rows)
    • Scroll down (all the way or somewhere in the middle)
    • Load much smaller data set into the grid (like ten times smaller)
    The result that was expected:
    • The view scrolls up automatically and the new data is shown
    The result that occurs instead:
    • The view stays where it is, shows no rows at all
    Test Case:
    Code:
    dummyDataLines = 300;
    
    generateDummyData = function(num) {
        var data = [];
        
        for (var i = 0; i < num; i++) {
            data.push([i]);
        }
        
        return data;
    };
            
    s = Ext.create('Ext.data.ArrayStore', {
        fields: ['dummy'],
        
        data: generateDummyData(dummyDataLines)
    });
    
    g = Ext.create('Ext.grid.Panel', {
        renderTo: Ext.getBody(),
        width: 200,
        height: 600,
        store: s,
        
        columns: [{
            dataIndex: 'dummy',
            text: 'Dummy',
            flex: 1
        }],
        
        plugins: [{
            pluginId: 'bufferedrenderer',
            ptype: 'bufferedrenderer'
        }]
    });
    
    view = g.getView(),
    viewEl = view.getEl(),
    smallDummyDataLines = dummyDataLines / 10,
    smallDummyData = generateDummyData(smallDummyDataLines);
    
    // scroll down to somewhere in the middle
    viewEl.scroll('down', me.dummyDataLines * 10);
            
    // wait for scrolling being complete
    Ext.defer(function() {
        // save scroll top before load to compare it later
        var scrollTopBeforeLoad = viewEl.getScrollTop();
        
        // load smaller set of data
        s.loadData(smallDummyData);
        
        console.log(viewEl.getScrollTop() < scrollTopBeforeLoad); // expected: true, instead: false
        
        console.log(view.all.startIndex < smallDummyDataLines); // expected: true, instead: false
        
        console.log(view.all.getCount()); // expected: >0, instead: 0
        
    }, 200);


    HELPFUL INFORMATION

    Possible fix:
    Code:
    Ext.define('Ext.fix.grid.plugin.BufferedRenderer', {
        override: 'Ext.grid.plugin.BufferedRenderer',
        
        getViewRange: function() {
            var me = this,
                store = me.store,
                view = me.view,
                range = me.callOverridden(arguments);
                
            // there is data but we have no rows to show? something has to be wrong!
            if (store.data.getCount() && Ext.isEmpty(range)) {
                me.viewSize = 0;
                me.onViewResize(view, null, view.getHeight());
                view.all.startIndex = 0;
                range = me.getViewRange();
            }
            
            return range;
        }
    });
    IMPORTANT:
    This fix only works if my other fix http://www.sencha.com/forum/showthre...ength&p=932009 is also active!

    I don't know if this is a good fix or if this is even the right place (in the code) to fix this. But after hours of searching the problem down this was the first thing that worked.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


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

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    6
    Vote Rating
    1
    dagardner is on a distinguished road

      0  

    Default


    Bug still exists in 4.2.1.883

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    6
    Vote Rating
    1
    dagardner is on a distinguished road

      0  

    Default Update?

    Update?


    Is there any update on this one? We are heavy users of both the Ext Grid Panel as well as filtering, so a fix on this would be a big win for us.

Thread Participants: 2