Jump to content


Photo

Custom sort on multiple columns

custom sort multiple columns

  • Please log in to reply
1 reply to this topic

#1 Alfred

Alfred
  • Members
  • 17 posts
  • Gender:Male
  • Location:UK

Posted 07 March 2017 - 07:34 AM

Hi,

 

I just tried custom sort. It seems that there is no way to link NextGrid1Compare to a particular column and NextGrid2Compare to another column etc. All custom sorts on the same grid end up in the same compare routine.

 

One has to do if Cell1.ColumnIndex = 3 then else if Cell1.ColumnIndex = 4  etc.  in this same Compare routine.

 

Please correct me if I am missing something.

 

Is it possible to have a sort on more than one column - e.g. sort by name then by DOB - when clicking on the name header?

 

With a little effort, one can do that in TStringGrid

 

Thanks,

 

Alfred



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 07 March 2017 - 11:36 PM

Hi,

I didn't build full multi-sort yet - precisely algorithm part. You can however use OnSortQuery event and sort grid.

Inside it you can use MultiSortedColumn, MultiSortedCount (from Columns property).

I hope that I will add full algorithm soon.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users