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 | }); |
从ExtJS3升级到ExtJS4时,远程排序参数传递方式发生变化,原'sort'和'dir'参数被替换为数组形式。本文提供了一个示例,展示了如何通过设置simpleSortMode为true来保持与ExtJS3兼容。
1752

被折叠的 条评论
为什么被折叠?



