Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Is there a way to sort a grid by more then one column? Collapse All
Subject Author Date
Offer Har Dec 17, 2008 - 2:10 PM

I need to sort a grid by several columns - First column A, secodary sort by column B etc etc, each one can be ascending or descending.


Thanks,


Ron.

Technical Support Dec 18, 2008 - 11:38 AM

You should specify the sorting rules for your grid window. For instance, the following code will sort grid window by column 7 ascending, then by column 2 descending and then by column 5 ascending:

CExtGridDataSortOrder gdso;
CExtGridDataSortOrder::ITEM_INFO _rule0( 7, true ); // first, sort by column 7 ascending
            _gdso.m_arrItems.Add(_rule0 );
CExtGridDataSortOrder::ITEM_INFO _rule1( 2, false ); // second, sort by column 2 descending
            _gdso.m_arrItems.Add(_rule1 );
CExtGridDataSortOrder::ITEM_INFO _rule2( 5, true ); // third, sort by column 5 ascending
            _gdso.m_arrItems.Add(_rule2 );
CExtGridWnd & wndGrid = . . .
            wndGrid.GridSortOrderSetup( false, _gdso );