Results 1 to 2 of 2

Thread: RemoteSort in Ext.Grid does not post, why?

  1. #1

    Default RemoteSort in Ext.Grid does not post, why?

    I have this code on a test page with Ext.Grid and PagingBar:

    Code:
    this.store = new Ext.data.JsonStore ({
    	        id: 'testStore',
    			url: 'grid.php',
    			root: 'rows',
    			sortInfo: {
    				field: 'rownum',
    				direction: 'ASC' 
    			},
    			fields: ['id', 'name'],
    			remoteSort: true
    		});
    		
    		this.pbar = new Ext.PagingToolbar ({
    			id: 'pbar',
    			pageSize: 5,
    			store: this.store,
    			displayInfo: true,
    			displayMsg: 'Displaying {0} - {1} of {2}',
    			emptyMsg: 'Nothing to display'
    		});
    
    		this.container = Ext.select('body').createChild();
    		
    		this.gridPanel = new Ext.grid.GridPanel({
    			id: 'gridTest',
    			stripeRows: true,
    			store: this.store,
    			remoteSort: true,
    			columns: [
    				{
    					id: 'id',
    					header: 'ID',
    					sortable: true
    				},
    				{
    					id: 'name',
    					header: 'Name',
    					sortable: true
    				},
    
    			],
    			autoExpandColumn: 'name',
    			bbar: this.pbar
    		});
    		
    		this.mainPanel = new Ext.Panel({
    			renderTo: 	this.container,
    			title : 'TabPanel container',
    			height: 400,
    			width: 400,
    			items: [this.gridPanel]
    		});
    		this.store.load();

    The JSON-Structure beeing returned looks something like:
    Code:
    {"rows":[{"id":1,"name":"Rome"},{"id":2,"name":"Karthago"},{"id":3,"name":"Kairo"},{"id":4,"name":"Byzanz"},{"id":5,"name":"Cologne"},{"id":6,"name":"London"},{"id":7,"name":"Largo"}]}
    After I added 'sortable: true' the columns are sortable but the 'store' doesn't post anything on sort. What am I missing? Any tips?

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    Did you process the sort on the server? You did specify remoteSort: true.

    start, limit, sort, dir need to be processed.

    You are also missing a totalProperty parameter, which provides the paging mechanism, but your result doesn't contain any total result, which is NOT the number of results returned.

    Taking your results for example. If that was the total number of records in your database.
    Requesting {"sort":"name","dir":"DESC","start":2,"limit":2}
    Your return should be:
    Code:
    // specifying totalProperty as "total" in JsonReader.
    {"total": 7,"rows":[{"id":7, "name":"Largo"},{"id":2,"name":"Karthago"}]}

Similar Threads

  1. remoteSort with grid issues
    By vtmoren in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 4 Sep 2009, 10:58 AM
  2. How to disable remotesort while grid is empty
    By chiru in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 15 Apr 2009, 1:41 AM
  3. Grid remoteSort on TabPanel
    By phedoreanu in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 6 Jan 2009, 2:22 AM
  4. Ext.data.Store, remoteSort:true and method:'get'
    By pbarnes in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 18 Jun 2008, 7:20 AM
  5. Help: grid remoteSort Problem!
    By marco_liu in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 1 Apr 2008, 10:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •