Problem with sorting unicode text column |
Post Reply |
Author | |
Marco1
Senior Member Joined: 16 January 2004 Location: Germany Status: Offline Points: 251 |
Post Options
Thanks(0)
Posted: 07 October 2008 at 1:01pm |
Hi,
there seems to be a problem in sorting unicode (wide) text in a column. A column with 500 records is filled with a presorted lastnames out of a database. No problem, sorting of mysql works fine. If one clicks on the header of the 'lastname'-column, the sorting arrow appears and the column gets resorted by the ReportControl. The correct order (of lastnames) returned by mysql is: Tacke test Thiele Ürün <-- Starts with german "Umlaut" Volk Zietlow The ReportControl sorts like Tacke Thiele Volk Zietlow test Ürün Small letters are sorted to the end, "Umlaute" (ö,ä,ü) which must be treated as o,a,u are sorted to the end, too. I haven't investigated further, perhaps anyone have observed/solved a similar problem? Thanx, Marco |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
It's using straight string compare.
I was just going to complain about this too - it should at least be doing case-insensitive sorting. Looks like there is a func to set sort callback, so you can do your own comparison... SetRowsCompareFunc |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
SetRowsCompareFunc doesn't look to be much use though
since you don't get told which column is being sorted. |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
CXTPReportRecordItem::Compare
override this for each item in your records that you want to control sort order on. |
|
adrien
Senior Member Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449 |
Post Options
Thanks(0)
|
actually this is a pain in the neck.
You would need to subclass for all items. It would be good if a compare func could be installed into the report control that could be used to compare strings. then this could be used to sort any field type that was a string. Otherwise you are constantly doing sad things like... class CXTPReportRecordItemCaseInsensitiveSortText : public CXTPReportRecordItemText { public: virtual int Compare(CXTPReportColumn* pColumn, CXTPReportRecordItem* pItem) { return m_strText.CompareNoCase(pItem->GetCaption(pColumn)); } }; and using CXTPReportRecordItemCaseInsensitiveSortText wherever you would otherwise use CXTPReportRecordItemText |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |