Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to turn off sorting in Report Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to turn off sorting in Report Control

 Post Reply Post Reply
Author
Message
robosport View Drop Down
Groupie
Groupie


Joined: 20 June 2005
Location: United States
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote robosport Quote  Post ReplyReply Direct Link To This Post Topic: How to turn off sorting in Report Control
    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.

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
robosport View Drop Down
Groupie
Groupie


Joined: 20 June 2005
Location: United States
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote robosport Quote  Post ReplyReply Direct Link To This Post 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.



Edited by robosport
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.