After the grid has been loaded with the data, if we try to sort any column, the default direction is ascending. Can we define a default sort for grid column such that after I load the grid, if I click on that column, it should get sorted in descending order first. I dont want to sort the grid with that column in that direction when it is loaded. This should happen after the grid has been loaded with the values. I am using remote Sort. So, I am clearing all the sorters whenever the grid is loaded so that it does not remember the previous sorting.I tried adding sorter dynamically on the server side but that would result in grid getting sorted with that property and direction when it is loaded which I dont want. I tried using sortInfo, it wont work.
Need it immediately, will be really thankful if anyone could answer this. Thank you so much.
Try to add sorters
to your store
:
Ext.define('SuggestedOrders.store.SODetails',
{
extend: 'Ext.data.Store',
// some more of your code
sorters:
{
field: 'column you need to sort by',
direction: 'DESC'
}
});
ADDENDUM:
You need to remove remoteSort: true
option. When this is set you will not be able to click on your column/attribute header to change it's sorting direction. Try without it and let me know ;)