pagingtoolbar in ExtJs: all the data is displayed at once when I want it to be separated in different pages

StackOverflow https://stackoverflow.com/questions/20380527

  •  29-08-2022
  •  | 
  •  

Question

I'm having a problem trying to add a toolbar and paging to my grid that provide search results. I want to add that because some searches bring up hundreds of items so I want to separate them in different pages and only show 25 of them by page.

My problem is that while the toolbar is okay and the different pages are here, the results still show up all at once every page. Like for exemple if a search brings you 200 results, there will be 8 pages (like it should), but each pages would show you the 200 items instead of only 25. I followed strictly (i think) the senchadoc article on the subject, so if anybody could help me that would be appreciated.

Thanks in advance. Here's my code :

panelResult: function() {
    var store = Ext.create('Ext.data.Store', {
        id:'userBeaconList',
        storeId:'userBeaconList',
        autoLoad: false,
        pageSize: 25,
        fields:[//BLABLABLA],
        data: //MyData,
        proxy: { 
            type: 'memory',
            reader: { type: 'json', root: 'items' } 
        }
    });     

        // specify segment of data you want to load using params
        store.load({
            params:{
                start:0,
                limit: 25,
            }
        });     

        return Ext.create('Ext.grid.Panel', {
            title: SarsatConf.listBeaconTitle,
            margin : '10 0 0 0',
            anchor: '100%' ,
            store: store,
            columns: [ //BLABLABLA],
            dockedItems: [{
                xtype: 'pagingtoolbar', 
                store: store,   
                dock: 'bottom',
                displayInfo: true
            }],  
        });
    } 
}
Was it helpful?

Solution

Your configuration seems OK. That's probably your server that is not respecting the limit and start params...

Another option would be to load the data from the server once, and put them into a memory proxy that will emulate paging on the client side.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top