1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    4
    Vote Rating
    0
    tom.hartwell-ec is on a distinguished road

      0  

    Default Unanswered: Using PagingToolbar and CheckboxSelectionModel in single GridPanel

    Unanswered: Using PagingToolbar and CheckboxSelectionModel in single GridPanel


    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

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    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


    You may want to take a look at this community extension: http://www.sencha.com/forum/showthre...ionPersistence

    I haven't used it but it could suit your needs.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi