Hybrid View

  1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    31
    Vote Rating
    -7
    bjornravers is infamous around these parts

      0  

    Default Unanswered: Paging Plugin

    Unanswered: Paging Plugin


    Hello everyone,

    I'm working on a application that loads a big store (7000 records). What I want do is show 50 and then let it load the next 50 (as the paging plugin does). Although I can't seem to get it to work. I can load my store, but its always looping the same 50 records. Right now the api is set like this:
    Code:
    url: 'http://admin.hishanghai.info/sencha/placesearch.php?action=read&callback=callback&q=e&page1',
    To get the next page it is:
    Code:
    url: 'http://admin.hishanghai.info/sencha/placesearch.php?action=read&callback=callback&q=e&page2',
    I don't know if it's possible to this and how. Right now I'm using the plugin like this:
    Code:
    plugins: [        
    {
                xclass: 'Ext.plugin.ListPaging',
                autoPaging: true
            }
        ],
    Any help will be greatly appreciated!

    Code:
    Ext.define('android.store.Searchstore', {
    	extend: 'Ext.data.Store',
    	requires: ['android.model.Searchmodel', 'Ext.data.proxy.JsonP'],
    
    
    	config: {
    		model: 'android.model.Searchmodel',
    		pageSize: 5,
    		sorters: [{ property : 'name', direction: 'DESC' }], 
    		autoLoad: true,
    		proxy: {
    			type: 'scripttag',
    			url: 'http://admin.hishanghai.info/sencha/placesearch.php?action=read&callback=callback&q=e',
    			reader: {
    				type: 'json',
    				rootProperty: 'place'
    			},
    			extraParams: {
    				action: 'read'
    			}
    		}
    	}
    })

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

      1  

    Default


    Does the "page" property changes when you click on "load more" ? To see it, you can alert the value from the beforeload function in your store.
    Also did you use the loadPage function and not the load function in your controller ?
    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
    Mar 2013
    Posts
    31
    Vote Rating
    -7
    bjornravers is infamous around these parts

      0  

    Default


    First of all thanks for the reply!
    Quote Originally Posted by siebmanb View Post
    Does the "page" property changes when you click on "load more" ? To see it, you can alert the value from the beforeload function in your store.
    proxy.PNG
    This is a screenshot from after 2 load more's, so I don't think it's loading the new page, although the data is changing. So when I do a load the first time it's this information:
    storedata1.jpg
    But when I scroll down and do a load more it shows the right data, it's just not showing in the list.
    storedata2.PNG
    Quote Originally Posted by siebmanb View Post
    Also did you use the loadPage function and not the load function in your controller ?
    Sorry, I don't understand what you mean here. I'm new to Sencha so sorry.. Can you maybe give an example of what you mean here..

    Sorry I'm still learning Sencha

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

      1  

    Default


    Ok first can you make sure your server returns the next 50 records ? For that, use Chrome debugging tool. In the network tab you can see the requests. You will be able to see the parameters in the url, and the response from the server.
    Twitter account @siebmanb.
    Co-founder & CEO at ButterflyEffect.
    Mobile application developer using Sencha Touch and Phonegap for iOS, Android and webapp.

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    31
    Vote Rating
    -7
    bjornravers is infamous around these parts

      0  

    Default Page number

    Page number


    Hi thanks for the reply!

    It's loading the next 50 now (so that's fixed), it's also loading the next page
    paging1.PNG
    As you can see here.

    Now I got another problem, when I do a next search the page is still on 5 (the last opened page). So I need to get it back to 1 when I do another search, also the "all records loaded" message doesn't show when the count is 0.
    paging2.PNG
    My list, i changed this to dataview list I don't know if this is the right way?
    Code:
    Ext.define('android.view.SearchList', {  extend: 'Ext.dataview.List',
      xtype: 'searchlist',
       requires: [
    		'android.store.Searchstore',
    		'Ext.plugin.ListPaging'
    		//'android.view.PlacesDetail',
        ],
    	
      config: {
       store: 'Searchstore',
      plugins: [
            {
               	xclass:'Ext.plugin.ListPaging',
                autoPaging: true,
    
    
                // These override the text; use CSS for styling
                loadMoreText: 'Loading...',
                noMoreRecordsText: 'All messages loaded'
            }
        ],
    Store:
    Code:
    model: 'android.model.Searchmodel',pageSize: 50,
    clearOnPageLoad: false,
    Thanks for the help

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    6
    Vote Rating
    2
    kailash.kelly is on a distinguished road

      1  

    Default Does the model contains id property

    Does the model contains id property


    Try to define id for the model

Thread Participants: 2

Tags for this Thread