Help my grid’s remote sorting (remoteSort:true) is not working after moving to Extjs 4

It’s always the little things that seem to catch you by surprise! Here’s a new one that may pop up when migrating your application from extjs3 to extjs4, and it has to do with server side behavior, so it will not be apparent on the front end. It looks like remote sort which used to pass the parameters ‘sort’ and ‘dir’ to the server has been changed to pass the parameters in an array object with the name ‘sort’ just like this instead:

1 [{"property":"field_name","direction":"ASC"}]

If you would like to change the sort call to the same format as Extjs 3 in order to transfer your applications just set the following parameter, simpleSortMode:true, in the proxy of the store and it will revert to the ‘old’ way of passing the parameters.
My sample remotely sorted store

01 Remote_sort_store_example = new Ext.data.Store({
02     model: ‘Remote_sort_store_’,
03     remoteSort:true,
04     pageSize:50,
05     proxy: {
06       type: 'ajax',
07       actionMethods: {
08         create : 'POST',
09         read   : 'POST',
10         update : 'POST',
11         destroy: 'POST'
12       },
13       simpleSortMode:true,     
14       url: 'learnsomethings.com/somethings/',
15       reader: {
16         type: 'json',
17         root: 'data',
18         totalProperty: 'results'
19       }
20     },
21     autoLoad: false
22   });

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章