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 » GridCtrl and sort at runtime
Re: GridCtrl and sort at runtime [message #8358 is a reply to message #8301] Mon, 05 March 2007 10:21 Go to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Sorry, you're right - it dosn't work. Anyway I've added Sort methods to GridCtrl - they will be available today in uvs and in rc3.

How to use them:

grid.Sort(0, GridCtrl::SORT_UP) - sorts the rows using values from column 0 (first non-fixed column) in up direction (lower values are on the top)

Id NAME("name");

grid.Sort(NAME) - the same, but column number is given as an Id, default sorting mode is SORT_UP

Sorting modes:

GridCtrl::SORT_UP - less values on the top
GridCtrl::SORT_DOWN - less values on the bottom
GridCtrl::SORT_ID - restore original row order

It is also possible to do "multisort":
grid.Sort(COL0, GridCtrl::SORT_UP, true)
    .Sort(COL5, GridCtrl::SORT_DOWN, true)
    .Sort(COL7, GridCtrl::SORT_UP, true);


Third parameter says we're doing multisort. If you don't like true/false arguments use MultiSort:

grid.MultiSort(COL0, GridCtrl::SORT_UP)
    .MultiSort(COL5, GridCtrl::SORT_DOWN)
    .MultiSort(COL7, GridCtrl::SORT_UP);


MultiSort does not refresh the grid by default! Use Repaint()

grid.MultiSort(COL0, GridCtrl::SORT_UP)
    .MultiSort(COL5, GridCtrl::SORT_DOWN)
    .MultiSort(COL7, GridCtrl::SORT_UP)
    .Repaint();


To switch off sorting and to restore original row order use ClearSort():

grid.ClearSort();

If you find any trouble report it please.


 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Escaping cursor in gridctrl
Next Topic: just looking for a basic arrayctrl example please
Goto Forum:
  


Current Time: Sat Aug 30 00:15:53 CEST 2025

Total time taken to generate the page: 0.04745 seconds