Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Vote Rating
    1
    azamatoak is on a distinguished road

      0  

    Default Store paging - only getting one item per page load with list paging

    Store paging - only getting one item per page load with list paging


    I am getting only one item per page load when the loadMore components issues a store load. I have specified a pageSize: 5 on the store and set the pageParam: 'offset' as that is what the server expects. Here is my store setup:

    Code:
    config: {
    storeId: 'myStore',
    		model: 'MyApp.model.Product',
            pageSize: 5,
            proxy: {
                type: 'ajax',
                method: 'GET',
                url: 'http://localhost/myapp/products',
                pageParam: 'offset',
                reader: {
                    type: 'json',
                    rootProperty: 'data.products.entries'
                }
            },
    I have a web server that accepts a limit and an offset. The limit, let's say 5, determines how many results to return back. This works fine. The offset, specifies, what number the next listing returned should start from. So an offset for the 2nd page should be 5 since the first one returns 0-4 (5 items). And for 3rd, it should be 10 and so on.

    Here's the structure
    page 1: limit 5, offset: 0
    page 2: limit 5, offset: 5,
    page 3: limit 5, offset: 10,
    ...

    Is this how store paging works in sencha touch?

    Or, does sencha touch actually use the 'page' number for the pageParam.

  2. #2
    Sencha User siebmanb's Avatar
    Join Date
    Aug 2011
    Location
    Geneva (CH) - Grenoble (FR)
    Posts
    253
    Vote Rating
    15
    siebmanb will become famous soon enough

      0  

    Default


    If you inspect the server answer from the Chrome debugging tool, you actually get all the data ?

    If I remember well Sencha uses the page param, you should see it appended in the request sent to the server (again, using Chrome debugging tool)
    Twitter account @siebmanb.
    Co-founder & CEO at ButterflyEffect.
    Mobile application developer using Sencha Touch and Phonegap for iOS, Android and webapp.

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    77
    Vote Rating
    1
    azamatoak is on a distinguished road

      0  

    Default


    I found that if I am using offsets instead of 'pages' I had to specify a 'start' parameter as well. Looking into the docs I was able to specify startParam: 'offset' and that did the trick. My code now looks like this:



    config: {storeId: 'myStore', model: 'MyApp.model.Product', pageSize: 5, proxy: { type: 'ajax', method: 'GET', url: 'http://localhost/myapp/products', startParam: 'offset', reader: { type: 'json', rootProperty: 'data.products.entries' } },

Thread Participants: 1

Tags for this Thread