0

I am following the code in the link below to page data on a Ext.grid.Panel without success. Data is rendered altogether in the panel without paging. Apparently, the paging toolbar has no data to display but it is correctly configured to the store that has the data and it is hanging as an item of the grid.

I have copied the exact configurations of store and grid from the example below but nothing happened. Why is the data not being paged?

http://jsfiddle.net/jardalu/TE4ah/

This is my store which is linked to the grid and the paging toolbar:

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        pageSize: 50,
        remoteSort: true,
        storeId: 'Users',
        autoLoad: false,
        model: 'AICWeb.model.User',
        sortOnLoad: false,
        proxy: {
            type: 'ajax',
            type: 'localstorage',
            simpleSortMode: true,
            reader: {
                type: 'xml'
            }
        },
        sorters: {
            property: 'email'
        }
    }, cfg)]);
}
jvarleiza
  • 1
  • 2
  • In the example fiddle that you've provided, you do notice that he's actually generating the data per page in the createFakeData function? You'll have to handle similarly in you backend code. And why do you have two types for your proxy?? – Yellen May 08 '15 at 16:08
  • I fixed the problem, thanks! if someone is interested I could upload the code... – jvarleiza May 14 '15 at 16:22

1 Answers1

0

If you are using localstorage you need to implement the PagingMemoryProxy. This should be the only type on the proxy config, and enable the paging config:

    proxy: {
        type: 'pagingmemory'
        enablePaging: true,
        ...
    }
cpastore84
  • 474
  • 2
  • 7
  • Great! its improving but not quite there.. Now the code looks like this proxy: { type: 'ajax', type: 'pagingmemory', enablePaging: true, filterParam: ' ', reader: { type: 'xml' } } But I the following error still appears to me... Uncaught TypeError: Cannot read property 'length' of undefined... the filters are the ones which are undefined. Thanks for the reply @cpastore84 ! – jvarleiza May 07 '15 at 19:48
  • You should only have one type on the proxy. It should be `type:'pagingmemory'`. Also, do you pass the data to the proxy? – cpastore84 May 07 '15 at 19:50
  • Data comes from a server. I am consuming a SOAP web service hosted on a .NET environment. The data received is added to the store which holds the proxy... @cpastore84 – jvarleiza May 07 '15 at 19:53
  • Try setting `remoteFilter:true`. Even though the data is local, the filters have to be 'passed' to the proxy. I think you can also remove the `filterParam: ''` from the config, so that they get passed as well. – cpastore84 May 07 '15 at 20:00
  • 1
    ...This is my store now... `constructor: function(cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ remoteFilter: true, storeId: 'Users', model: 'AICWeb.model.User', proxy: { type: 'pagingmemory', enablePaging: true } }, cfg)]); }`.... The problem is in the class `PagingMemoryProxy`... filters = operation.filters; if (filters.length > 0) {...} `filters is undefined` – jvarleiza May 07 '15 at 20:50