Lazarus

Programming => LCL => Topic started by: FrankBKK on June 15, 2021, 09:33:23 am

Title: TStringGrid ColumnClickSort - how to 'unsort' ?
Post by: FrankBKK on June 15, 2021, 09:33:23 am
TStringGrid allows to change the sorting of a column via ColumnClickSort when clicking on the Header, click again to switch Asc/Desc sort order.

How can I get back the original, unsorted view ?





Title: Re: TStringGrid ColumnClickSort - how to 'unsort' ?
Post by: Zvoni on June 15, 2021, 09:42:11 am
You can't.
Except if you saved the "original" sort somewhere
Title: Re: TStringGrid ColumnClickSort - how to 'unsort' ?
Post by: FrankBKK on June 15, 2021, 07:24:13 pm
Thanks for the quick reply - that's bad though ....

What is the best approach to circumvent this ?

A secondary backup grid to restore the original sort order seems like overkill and to add an add. sort column is something I try to avoid - are there any other options ?
Title: Re: TStringGrid ColumnClickSort - how to 'unsort' ?
Post by: Awkward on June 15, 2021, 07:39:20 pm
why not to add hidden column with numbers for original order and sort by it when needs?
Title: Re: TStringGrid ColumnClickSort - how to 'unsort' ?
Post by: Zvoni on June 15, 2021, 09:56:57 pm
IIRC, the row-Property (or was it rows?) is of type TStrings, so a TStringList could/should work
TinyPortal © 2005-2018