SebiDev123 Posted May 20, 2015 Share 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? Link to comment Share on other sites More sharing options...
Marlon Nardi Posted May 20, 2015 Share Posted May 20, 2015 "\FMSoft\Framework\uniGUI\Demos\Desktop\GridColumnSort" Link to comment Share on other sites More sharing options...
Abaksoft Posted May 20, 2015 Share Posted May 20, 2015 http://prime.fmsoft.net/demo/mdemo/mdemo.dll Regards.. Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted May 26, 2015 Share 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 Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted May 27, 2015 Share Posted May 27, 2015 No ideas how that could be done? Link to comment Share on other sites More sharing options...
mhmda Posted July 20, 2015 Share 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 Link to comment Share on other sites More sharing options...
Jean-Marc Kiener Posted July 22, 2015 Share Posted July 22, 2015 Thanks mohammad, I will try it out. Link to comment Share on other sites More sharing options...
MasterDash Posted April 22, 2017 Share Posted April 22, 2017 not work for me 1 Link to comment Share on other sites More sharing options...
arilotta Posted November 22, 2017 Share 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();} Link to comment Share on other sites More sharing options...
Kattes Posted November 30, 2022 Share Posted November 30, 2022 Hi, is there any solution for the newer UniGui versions? Best regards, Kattes Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 Hello, Also this post may help you: Link to comment Share on other sites More sharing options...
Kattes Posted November 30, 2022 Share 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. Link to comment Share on other sites More sharing options...
Sherzod Posted November 30, 2022 Share Posted November 30, 2022 Hi, Thanks. I would like to ask you, can you make a simple test case to reproduce your case? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now