View Full Version : RemoteSort in Ext.Grid does not post, why?

18 Jun 2010, 8:06 AM
I have this code on a test page with Ext.Grid and PagingBar:

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]

The JSON-Structure beeing returned looks something like:


After I added 'sortable: true' the columns are sortable but the 'store' doesn't post anything on sort. What am I missing? Any tips?

18 Jun 2010, 6:29 PM
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:

// specifying totalProperty as "total" in JsonReader.
{"total": 7,"rows":[{"id":7, "name":"Largo"},{"id":2,"name":"Karthago"}]}