SebiDev123 Posted May 20, 2015 Posted May 20, 2015 Hi folks, Simple question but i did not find any solution in the forum: How can i set/get the sort status (asc/desc) of a column? Quote
Marlon Nardi Posted May 20, 2015 Posted May 20, 2015 "\FMSoft\Framework\uniGUI\Demos\Desktop\GridColumnSort" Quote
Abaksoft Posted May 20, 2015 Posted May 20, 2015 http://prime.fmsoft.net/demo/mdemo/mdemo.dll Regards.. Quote
Jean-Marc Kiener Posted May 26, 2015 Posted May 26, 2015 Hi Marlon and Abaksoft,Thats not what SebiDev123 is searching for. He ask for sorting a column by code as it would be when i click on the column header (So the column header shows the sorting direction with the small triangle). In the demo, the same problem occurs. If the form is opened, the grid shows no column as sorted, but in fact the data is sorted by the first column, so the first column header should shown as sorted. See the screenshots below. Second is, it would be nice if we could detect which columns are sorted in which manner, write this per example in a cookie and if the user comes back opening the grid again, whe could sort the data and SHOW the Columns in the same manner as he leaved the grid before. Thas the point i think. 1 Quote
mhmda Posted July 20, 2015 Posted July 20, 2015 I have a solution (works great for me) : function added(sender, container, pos, eOpts) { sender.getStore().sorters.add(new Ext.util.Sorter({property: '1',direction: 'DESC'})); } Where '1' is SECOND column... 0: first column.....etc Quote
arilotta Posted November 22, 2017 Posted November 22, 2017 In my case it works if you add the following statement: sender.view.refresh(); Then, the complete solution should be: function added(sender, container, pos, eOpts){sender.getStore().sorters.add(new Ext.util.Sorter({property: '1',direction: 'DESC'})); sender.view.refresh();} Quote
Kattes Posted November 30, 2022 Posted November 30, 2022 Hi, is there any solution for the newer UniGui versions? Best regards, Kattes Quote
Kattes Posted November 30, 2022 Posted November 30, 2022 Dear Sherzod, first of all, thank you very much for your quick reply. UniDBGrid1.ClientEvents.ExtEvents.SetText('reconfigure=function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)'+ ' { if (columns[3].isSortable()) { columns[3].sort('''+cSort+''') }}'); In principle your solution works, but has some side effect to the "Locate" command I am using to select a specific row in the UniDBGrid. procedure TuDashboardFrame.UniDBGrid1AfterLoad(Sender: TUniDBGrid); var FD : TFDQuery; iTID : integer; begin iTID := UniMainModule.TicketID; FD := TFDQuery(UniDBGrid1.Datasource.DataSet); if GetValueAsInteger(FD,'Ticket_Id') <> iTID then begin FD.Refresh; FD.Locate('Ticket_ID',iTID,[]); end; end; The "Locate" no longer works. Do you have another suggestion? Finally, I just want to get control over the sort indicator without having it also re-sort the contents of the assigned column. Quote
Sherzod Posted November 30, 2022 Posted November 30, 2022 Hi, Thanks. I would like to ask you, can you make a simple test case to reproduce your case? Quote
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.