Print Page | Close Window

How to turn off sorting in Report Control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2588
Printed Date: 08 November 2025 at 4:03pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to turn off sorting in Report Control
Posted By: robosport
Subject: How to turn off sorting in Report Control
Date Posted: 18 July 2005 at 3:35am

I'm sure there is an easy answer to this and I've simply missed it in my searching on the forum and in the code...

I'm using a CXTPReportControl with multiple columns. By default it sorts the first column alphabetically when I call Populate.

How can I disable sorting so that the records are listed in the order that I added them?

I've tried setting all columns->SetSortable( FALSE ); prior to calling Populate but that did not work.

Thanks in advance.




Replies:
Posted By: sserge
Date Posted: 18 July 2005 at 8:07am
The control sorts records by 2 collections: GroupsOrder and SortOrder. If both of them contain zero elements, the sorting wouldn't be called.

So, please check elements count in CXTPReportColumns::GetGroupsOrder() and CXTPReportColumns::GetSortOrder() collections.

--
WBR,
Serge


Posted By: robosport
Date Posted: 18 July 2005 at 12:49pm

Thank you sserge for the reply.

I was able to call Clear for both CXTPReportColumns::GetGroupsOrder()  and CXTPReportColumns::GetSortOrder() and then confirmed both were empty by using GetCount just before calling Populate.

Unfortunately after calling Populate the Report Control is still sorted (no change) alphabetically by the first column.

[UPDATE] Your solution was correct. I had recently switched my storage of the items to be put into the report from a std::vector to a std::map.

 I forgot a map automatically sorts the keys by its very nature, so iterating through the map was giving me a sorted list and not the order I generated the list of records in.

Thank you.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net