0
votes

I have a store that is huge, (thousands of rows), and in order for my app to run faster I would like to set a max page Size to load when the app is first opened. Then only display the rest of the data of the user scrolls down. Here is what I have so far:

    Ext.define("myApp.store.foo", {
    extend : 'Ext.data.Store',

    requires : ['Ext.data.Store', 'myApp.model.foo', 'Ext.data.reader.Xml'],

    alias: 'myApp.store.approachMainStore',


    config: {
    model : 'myApp.model.foo',
    storeId: 'mainStore',
    autoLoad: true,
    pageSize: 50, 

    proxy : {
        type : "ajax",
        url : 'resources/images/data/bar_all.xml',
        reader : {
            type : "xml",
            pageParam: 'page',
            clearOnPageLoad: false, 
            rootProperty : 'foo',
            record : 'bar'
        }
    }

    }
});

I'm using a xtype of List. But when I run my app everything works except it loads all the data just as before I added pageSize: 50, What am I missing?

Running Sencha Touch 2.4.1

2
I'm guessing that since the data source is a static XML file, there is no way to filter/restrict the records returned. You could perhaps look into buffering the store docs-origin.sencha.com/touch/2.4/2.4.1-apidocs/#!/api/…Rob Schmuecker

2 Answers

0
votes

You should use ListPaging plugin in the list.

 {
        xclass: 'Ext.plugin.ListPaging',
        autoPaging: true,
        loadMoreText : 'Loading more',
        noMoreRecordsText : 'loaded'
 }

Please check sencha touch documentation for further info.

0
votes

In order for paging to work the server side needs to respond to the parameters sent. You have to replace the static XML file with one that is generated on the fly. That script needs to recognize the paging parameters (page, limit, start) and it must return total and count in addition to the data.

If you don't mind to send all the data and just want to speed up the display, look into bufferedRenderer.

I just noticed that the question is about sencha touch and I'm answering for ExtJs 4.2. I'm not sure if it is valid for both.