Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Two "basic" operations on GridCtrl
Re: Two "basic" operations on GridCtrl [message #21115 is a reply to message #21082] Mon, 04 May 2009 09:39 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

GridCtrl by default uses StdValueCompare function which is "type aware" - so it sorts properly int, double, boolean, time and date types. Unknown types are converted to string and compare as strings (just take a look at Core/Value.cpp file)
If you want to do your own sorting in WhenSort use GetSortOrder method which returns Vector<SortOrder> - the vector with information about columns clicked by user to sort the grid data.

SortOrder consists of:
int id - id of column (each column has unique id which remain the same no matter of real visual column position)
Id name - Id object connected with column
bool ascending, descendig - direction of sorting (only one is set to true of course)

To remove WhenSort action just write:
grid.WhenSort.Clear();


I implemented WhenSort to being able to react on sort action in scenario when you reload grid data. For example when user clicks column I modify the sql sent to database and the database sorts data and returns it back to the grid. If you would like to sort data already loaded to grid (without clearing grid and populating it again) I'd have to expose internal RowItems collection and I don't want to do this.
So please paste a test case that ilustrate the problem in more datails. We'll try to find a correct solution then.

[Updated on: Mon, 04 May 2009 09:41]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ArrayCtrl.AsQtf bug?
Next Topic: LineEdit font bug
Goto Forum:
  


Current Time: Fri Jul 18 03:36:25 CEST 2025

Total time taken to generate the page: 0.03794 seconds