1
votes

I'm having a problem in understanding how I can define my custom sorter function on Grid

I'm using Extjs 6.2.0 (EDIT: see below, at the end of post)

When I try to set up that on store like below:

 sorters: [{
    {
        sorterFn: function() {
            console.log("I'm running from store");
        }
    }
 }]

This runs only once, and actually this makes sense, because documentation says that those are initial sorters

I also tried using that on column

 dataIndex: 'category_name',
 sorter: {
     sorterFn: function() {
         console.log("I'm running from column");
     }
 }

and this function doesnt even run (console.log() not appearing in browser window )

EDIT: It turned out that I'm not using 6.2.0 but 6.0, so sorry for such silly mistake.. Anyways, someone know how I can create custom sort function for column grid in that version ?

1
Ex.grid.column.Column.sorter: A Sorter, or sorter config object to apply when the standard user interface sort gesture is invoked. This is usually clicking this column header, but there are also menu options to sort ascending or descending. - Have you tried to invoke the user interface sort gesture? - Alexander
You mean if I tried clicking column header in that second example ? I did, nothing happens - M.D
Indeed it works... - M.D
Ok, turned out that I wasn't using Extjs 6.2.0 but 6.0.2, and that version doesn't even have 'sorter' paramater in grid column So sorry for such silly mistake Do you know by a chance how to implement custom sort function in that version ? - M.D

1 Answers

2
votes

Okay eveyrone, I managed to achieve what I wanted with "sortType" custom function defined on field in Model.

Thanks !