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

  • SEARCH
  • Home
  • 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 7173595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:51:27+00:00 2026-05-28T15:51:27+00:00

I’ve posted this over on the Sencha forums, wanted to also post it here

  • 0

I’ve posted this over on the Sencha forums, wanted to also post it here just in case:

I have a GridPanel that utilizes a PagingToolbar and a CheckboxSelectionModel. I want to keep track of selections across pages. I’m nearly there, but I’m running into issues with the PagingToolbar controls (such as next page) firing a ‘selectionchange’ event on the my selection model.

Here’s a simplified sample of my code:

Code:

var sm = Ext.create('Ext.selection.CheckboxModel', {
    listeners:{
        selectionchange: function(selectionModel, selectedRecords, options){
            console.log("Selection Change!!");
            // CODE HERE TO KEEP TRACK OF SELECTIONS/DESELECTIONS
        }
    }
});

var grid = Ext.create('Ext.grid.Panel', {
    autoScroll:true,
    store: store,
    defaults: {
        sortable:true
    },
    selModel: sm,
    dockedItems: [{
        xtype: 'pagingtoolbar',
        store: store,
        dock: 'bottom',
        displayInfo: true
    }],
    listeners: {'beforerender' : {fn:function(){
        store.load({params:params});

    }}}
});
store.on('load', function() {
    console.log('loading');
    console.log(params);
    console.log('selecting...');
    var records = this.getNewRecords();
    var recordsToSelect = getRecordsToSelect(records);
    sm.select(recordsToSelect, true, true);
});

I assumed that I could select the records on the load event and not trigger any events.

What’s happening here is that the selectionchange event is being triggered on changing the page of data and I don’t want that to occur. Ideally, only user clicking would be tracked as ‘selectionchange’ events, not any other component’s events bubbling up and triggering the event on my selection model. Looking at the source code, the only event I could see that fires on the PagingToolbar is ‘change’. I was trying to follow how that is handled by the GridPanel, TablePanel, Gridview, etc, but I’m just not seeing the path of the event. Even then, I’m not sure how to suppress events from the PagingToolbar to the SelectionModel.

Thanks in advance,
Tom

  • 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-28T15:51:28+00:00Added an answer on May 28, 2026 at 3:51 pm

    I’ve managed to handle that. The key is to detect where page changes. Easiest solution is to set buffer for selection listener and check for Store.loading property.
    Here is my implementation of selection model:

    var selModel = Ext.create('Ext.selection.CheckboxModel', {
        multipageSelection: {},
        listeners:{
            selectionchange: function(selectionModel, selectedRecords, options){
                // do not change selection on page change
                if (selectedRecords.length == 0 && this.store.loading == true && this.store.currentPage != this.page) {
                    return;
                }
    
                // remove selection on refresh
                if (this.store.loading == true) {
                    this.multipageSelection = {};
                    return;
                }
    
                // remove old selection from this page
                this.store.data.each(function(i) {
                    delete this.multipageSelection[i.id];
                }, this);
    
                // select records
                Ext.each(selectedRecords, function(i) {
                    this.multipageSelection[i.id] = true;
                }, this);
            },
            buffer: 5
        },
        restoreSelection: function() {
            this.store.data.each(function(i) {
                if (this.multipageSelection[i.id] == true) {
                    this.select(i, true, true);
                }
            }, this);
            this.page = this.store.currentPage;
        }
    

    And additional binding to store is required:

    store.on('load', grid.getSelectionModel().restoreSelection, grid.getSelectionModel());
    

    Working sample: http://jsfiddle.net/pqVmb/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.