Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:32:54+00:00 2026-05-29T10:32:54+00:00

In ExtJS 4.1 beta 2 I managed to implement an infinite scroll grid with

  • 0

In ExtJS 4.1 beta 2 I managed to implement an infinite scroll grid with a remote store. I basically took an existing (fully operational) paging grid (with remote store, filtering and sorting) and then put in the appropriate configs for infinite scrolling:

// Use a PagingGridScroller (this is interchangeable with a PagingToolbar)
verticalScrollerType: 'paginggridscroller',
// do not reset the scrollbar when the view refreshs
invalidateScrollerOnRefresh: false,
// infinite scrolling does not support selection
disableSelection: true,   

It doesn’t say this anywhere in the docs(see Infinite Scrolling section), but you need to set your store to have buffered: true config. And you can’t load with store.load() it needs to be done like this:

store.prefetch({
    start: 0,
    limit: 200,
    callback: function() {
        store.guaranteeRange(0, 99);
    }
});   

With all that, everything works great if I scroll slowly and thus allow the data to prefetch, don’t use any filters and don’t use any sorting.

However, if I scroll fast or try to make the infinite scroll grid reload with a filter active or while sorting it all breaks apart. Error is options is undefined.

I’ve spent a couple of hours doing some tracing in the code and googling and aside from concluding that no one has implemented an infinite scroll grid with remote filters and remote scrolling, I have found the following:

The filtering is breaking down because of this method in Ext.data.Store which is called by the infinite scroller when it needs more data from the server:

mask: function() {
    this.masked = true;   
    this.fireEvent('beforeload');
},

For some reason, this method fires the beforeload event without the Ext.data.Operation parameter which is supposed to be part of it as specified here.

As a result, an error occurs in the onbeforeload handler in Ext.ux.grid.FiltersFeature because of course “options” is undefined:

/**
 * @private
 * Handler for store's beforeload event when configured for remote filtering
 * @param {Object} store
 * @param {Object} options
 */
onBeforeLoad : function (store, options) {

    options.params = options.params || {};
    this.cleanParams(options.params);
    var params = this.buildQuery(this.getFilterData());
    Ext.apply(options.params, params);

},

I can cut out the call to this mask method from the PagingScroller code and then the scroll functionality is great. I can scroll as fast as I like and it loads the data properly. But then filters and sort does not get applied to the ajax requests.

I haven’t dived as much into the sorting aspect but I think it something similar with this mask method because sort is simply another element contained by the operation object and it causes no operation object to be passed to the ajax request.

I’m thinking that if I could just figure out how to force the mask method to fire beforeload with the operation parameter (like the docs say it is supposed to) everything will be fine. Problem is, I haven’t been able to figure out how to do that. Any suggestions?

If someone would just tell me that I am wrong and people have in fact made this work, I would be inspired, but a snippet of any overrides you used to handle this problem or a link would be much appreciated.

I’ve also tried downgrading to 4.0.7 and 4.0.2a and I get the same results, so it isn’t just a beta problem.

Update – 7 Feb 12:

This seems like it may actually be a Ext.ux.grid.FilterFeature problem not an infinite scrolling problem. If I remove the FilterFeature config entirely infinite scrolling works great and does pass the sorting params to my backend when I sort by a column. I will start looking into the FilterFeature end of things.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:32:55+00:00Added an answer on May 29, 2026 at 10:32 am

    SUCCESS! I have infinite scrolling working with a remote filter and remote sort (this is in 4.1 beta 2, but because I was getting the same errors in 4.02a and 4.0.7 I imagine that it would resolve those too). Basically, I just had to add a few overrides in my code.

    I haven’t done testing in other browsers but I have it going in FF. Here are the overrides that I am using:

    Ext.override(Ext.data.Store, {
    
        // Handle prefetch when all the data is there and add purging
        prefetchPage: function(page, options, forceLoad) {
    
            var me = this,
                pageSize = me.pageSize || 25,
                start = (page - 1) * me.pageSize,
                end = start + pageSize;
    
            // A good time to remove records greater than cache
            me.purgeRecords();
    
            // No more data to prefetch
            if (me.getCount() === me.getTotalCount() && !forceLoad) {
                return;
            }
    
            // Currently not requesting this page and range isn't already satisified
            if (Ext.Array.indexOf(me.pagesRequested, page) === -1 && !me.rangeSatisfied(start, end)) {
                me.pagesRequested.push(page);
    
                // Copy options into a new object so as not to mutate passed in objects
                options = Ext.apply({
                    page     : page,
                    start    : start,
                    limit    : pageSize,
                    callback : me.onWaitForGuarantee,
                    scope    : me
                }, options);
                me.prefetch(options);
            }
        },
    
        // Fixes too big guaranteedEnd and forces load even if all data is there
        doSort: function() {
            var me = this;
            if (me.buffered) {
                me.prefetchData.clear();
                me.prefetchPage(1, {
                    callback: function(records, operation, success) {
                        if (success) {
                            guaranteeRange = records.length < 100 ? records.length : 100
                            me.guaranteedStart = 0;
                            me.guaranteedEnd = 99; // should be more dynamic
                            me.loadRecords(Ext.Array.slice(records, 0, guaranteeRange));
                            me.unmask();
                        }
                    }
                }, true);
                me.mask();
            }
        }
    });   
    
    Ext.override(Ext.ux.grid.FiltersFeature, {
    
        onBeforeLoad: Ext.emptyFn,
    
        // Appends the filter params, fixes too big guaranteedEnd and forces load even if all data is there
        reload: function() {
            var me = this,
                grid = me.getGridPanel(),
                filters = grid.filters.getFilterData(),
                store = me.view.getStore(),
                proxy = store.getProxy();
    
            store.prefetchData.clear();
            proxy.extraParams = this.buildQuery(filters);
            store.prefetchPage(1, {
                callback: function(records, operation, success) {
                    if (success) {
                            guaranteeRange = records.length < 100 ? records.length : 100;
                            store.guaranteedStart = 0;
                            store.guaranteedEnd = 99; // should be more dynamic
                            store.loadRecords(Ext.Array.slice(records, 0, guaranteeRange));
                        store.unmask();
                    }
                } 
            }, true);
            store.mask();
        }
    });
    

    My store is configured like so:

    // the paged store of account data
    var store = Ext.create('Ext.data.Store', {
        model: 'Account',
        remoteSort: true,
        buffered: true,
        proxy: {
            type: 'ajax', 
            url: '../list?name=accounts', //<-- supports remote filter and remote sort
            simpleSortMode: true,
            reader: {
                type: 'json',
                root: 'rows',
                totalProperty: 'total'
            }
        },
        pageSize: 200
    });
    

    The grid is:

    // the infinite scroll grid with filters
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        viewConfig: {
            trackOver: false,
            singleSelect: true,
        },
        features: [{
            ftype: 'filters',
            updateBuffer: 1000 // trigger load after a 1 second timer
        }],
        verticalScrollerType: 'paginggridscroller',
        invalidateScrollerOnRefresh: false,         
        // grid columns
        columns: [columns...],
    });
    

    Also the initial load must be done like this (not just store.load()):

    store.prefetch({
        start: 0,
        limit: 200,
        callback: function() {
            store.guaranteeRange(0, 99);
        }
    });    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in ExtJS 3.x grid panels that used a remote datastore and paging bars had
I have an ExtJS combobox with a remote data store behind it. In all
In extjs, if I have a grid definition like this: xtype: 'grid', store: 'someStore',
In ExtJS, how do I load a store when I display a grid? I
ExtJS Charts, I am using an Ext column chart and I want to implement
I have an ExtJS grid on a web page and I'd like to save
In ExtJS version 3, there was a property grid in Ext.grid.RowSelectionModel and in version
The ExtJS grid is awesome. However, the GPL license is not. Is there a
I have ExtJS Grid. And I am using Roweditor plugin with combobox. When I
ExtJS 4. I have grid and editor for it. Editor have listener. How to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.