mterceno Posted July 4, 2018 Share Posted July 4, 2018 Hi all, I have looking for a long time a solution to define a default column sort but nothing. Currently, when I activate the sort in a UniDBGrid, none column s sorted when the Dataset opens (no icon - arrow - in title). I must click on columns header to see this sort icon. How can I to show this icon on the first column directly at first data load ? At initialisation => no sort When I click on title PS: I have found this solution but I must call this code after all clients objects / data are rendered. This solution is not good. DBGrid reloads the data and tries to sort it while the data is already sorted in that order => no look good ! UniSession.AddJS(UniDBGrid1.JSName+'.store.sorters.clear()'); UniSession.AddJS(UniDBGrid1.JSName+'.store.sorters.add(new Ext.util.Sorter({property: "0", direction: "ASC"}))'); Thank you for your help. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 4, 2018 Share Posted July 4, 2018 Hi, Can you try this?: UniDBGrid -> ClientEvents -> ExtEvents ->... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { if (columns[0].isSortable()) { columns[0].sort('ASC') } } Quote Link to comment Share on other sites More sharing options...
mterceno Posted July 5, 2018 Author Share Posted July 5, 2018 Hi, Can you try this?: UniDBGrid -> ClientEvents -> ExtEvents ->... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { if (columns[0].isSortable()) { columns[0].sort('ASC') } } Hi it works !!! I have found also other solution with that : UniDBGrid.ClientEvents.UniEvents: function store.afterCreate(sender) { sender.getSorters().add(new Ext.util.Sorter({property: "0", direction: "ASC"})); sender.sortOnLoad = true; } But your code is more pretty. Thank you, Quote Link to comment Share on other sites More sharing options...
55143681 Posted January 9, 2019 Share Posted January 9, 2019 On 7/5/2018 at 3:39 PM, mterceno said: Hi it works !!! I have found also other solution with that : UniDBGrid.ClientEvents.UniEvents: function store.afterCreate(sender) { sender.getSorters().add(new Ext.util.Sorter({property: "0", direction: "ASC"})); sender.sortOnLoad = true; } But your code is more pretty. Thank you, 1482,google,give me an error: columns[0].isSortable is not a function Quote Link to comment Share on other sites More sharing options...
Kenneth Posted November 4, 2020 Share Posted November 4, 2020 On 7/5/2018 at 12:59 AM, Sherzod said: Hi, Can you try this?: UniDBGrid -> ClientEvents -> ExtEvents ->... function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts) { if (columns[0].isSortable()) { columns[0].sort('ASC') } } 👍 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.