dimanche 26 novembre 2017

Ext JS SORTING (2, 5, 30, 100) compare function

Using ExtJS 4.2.3. I have list of values which sorts as string and it looks like:

   DATA1 (NOW)  | DATA1 (SHOULD BE) |  
  -----------------------------------
       100      |         2         |  
       2        |         5         | 
       30       |         30        | 
       5        |         100       |

Exanple of code on ExtJS:

 DATA1_store = new Ext.data.TreeStore({
                model: DATA1.id,
                proxy: {
                    url: proxyCfg.url,
                    type: proxyCfg.type,
                    reader: {
                        type: "json",
                        root: "data"
                    }
                },
                remoteSort: true,
                sorters: [{
                    property: "data1",
                    direction: "ASC"
                }],

Here should work compare function like on javascript:

points.sort(function(a, b){return a - b})

Asking for help with compare function or mb another way for code part above of ext JS.




Aucun commentaire:

Enregistrer un commentaire