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 » How to sort CExtReportGridWnd by date and time, not date string. Collapse All
Subject Author Date
Robert Hofstetter Apr 28, 2010 - 2:04 AM

My CExtReportGridWnd has a date column.


when I click the column header, it is sorted by the date string alphabetically, not by the actual date and time. 


Please let me know to sort the ReportGrid by date.


Thanks

Technical Support Apr 28, 2010 - 10:06 AM

If the date time column in your report grid control contains CExtGridCellString grid cells with text lines formatted as date time, then this column will be sorted as a text column. But if your date time column contains CExtGridCellDateTime grid cells, this column will be sorted correctly. The CExtGridCell::CompareEx() virtual method is used for comparing pairs of grid cells during sorting. Most of grid cell classes implement this virtual method for correct comparison. The CExtGridCellDateTime grid cell understands when it’s compared with other CExtGridCellDateTime grid cell and performs correct date data comparison. In other cases, when the CExtGridCellDateTime grid cell is compared with any other type of cell, then the basic text comparison is performed.