Pregunta

For my remote-sort i use in ExtJS 3 the keyword asDate which was sent in direction-part of request:

sort:my_date
dir:asDate ASC

In ExtJS 4 i miss the sortType information in Request:

sort:[{"property":"my_date","direction":"DESC"}]

is there any way to get the sortType information on server side?

¿Fue útil?

Solución

You can the override encodeSorters function. I'll make you an example :)

http://jsfiddle.net/Vandeplas/xLz5C/1/

var store = Ext.create('Ext.data.Store', {
     model: 'User',
     sorters: [{
         property: 'age',
         direction: 'DESC',
         sortType: 'asDate'
     }, {
         property: 'firstName',
         direction: 'ASC'
     }],
     proxy: {
         type: 'ajax',
         url: '/echo/json/',
         reader: {
             type: 'json',
             root: 'users'
         },
         encodeSorters: function (sorters) {
             var min = [],
                 length = sorters.length,
                 i = 0;

             for (; i < length; i++) {
                 min[i] = {
                     property: sorters[i].property,
                     direction: sorters[i].direction,
                     sortType: sorters[i].sortType
                 };
             }
             return this.applyEncoding(min);

         }
     }
 });
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top