Jump to content


Photo

Overriding Sort.


  • Please log in to reply
5 replies to this topic

#1 Speed

Speed
  • Members
  • 190 posts
  • Gender:Male

Posted 02 December 2017 - 02:39 PM

Hi Boki,

 

Is there any way to override sorting?  I have set each column to Sorted := False and SortType := stCustom because I am using a memory table to perform the sort then loading the rows into the grid.  However, it appears the grid is interfering with the sorting somehow as the sorting changes once the rows are loaded into the grid.

 

Regards,

 

Steve

 

 



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 02 December 2017 - 10:35 PM

Hi Steve,

Not sure maybe this article can help you:
http://dn.bergsoft.n...tom-sorting.htm

This is a standard way I do custom sorting.
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.

#3 Speed

Speed
  • Members
  • 190 posts
  • Gender:Male

Posted 03 December 2017 - 12:59 AM

Hi Boki,

 

Sorry, I didn't explain that clearly.  What I'm doing is;

  1. The user clicks the column header to sort.  I'm now using the header onclick event for this.
  2. This fires an event.  The event handler calls code to sort the memory table, which then reload the grid with the sorted data.
  3. The sort indicator on the column header points in the appropriate direction for ascending or descending sort.

The sorting is handled entirely outside of the grid (which I have already coded) - the grid doesn't do the sorting at all. 

 

Is it possible to set the sort direction indicator programmatically without using the grid internal sorting?

 

Regards,

 

Steve



#4 Speed

Speed
  • Members
  • 190 posts
  • Gender:Male

Posted 03 December 2017 - 04:17 AM

Hi Boki,

 

I got around it by using a Header glyph instead, but the grid's sort indicator still shows.

 

 

GridSortIndicator.jpg

 

 

  • AppearanceOptions is set to [ ].
  • All columns have coCanSort option set to False.
  • All columns have sorted set to False.

 

Regards,

Steve

 

 

 



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 03 December 2017 - 02:15 PM

Hi Steve,

Maybe HideArrow property in Column.Header can help?
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.

#6 Speed

Speed
  • Members
  • 190 posts
  • Gender:Male

Posted 04 December 2017 - 05:51 AM

Maybe HideArrow property in Column.Header can help?

 

Hi Boki,

 

Yeah I tried that but it didn't seem to make any difference. 

 

I then discovered that I had forgotten to remove some code that sorted the Date column on application startup using the grid's sorting.  After that, even when I set Column.Header.HideArrow to True the grid's sort indicator still appears.

 

By replacing the grid's sort with my own sort method on startup the grid's sort indicator no longer appears.  :)

 

Regards,

 

Steve






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users