Print Page | Close Window

How to:Get Item after re-sorting.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=23219
Printed Date: 27 April 2024 at 4:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to:Get Item after re-sorting.
Posted By: Glaber8
Subject: How to:Get Item after re-sorting.
Date Posted: 02 December 2016 at 4:15am
Dear CJ Team:
  Here is the problem I have: I created 5 records (1,2,3,4,5) with 3 columns in report control, after clicking any columns headers, the records will resorted. However the retrieved item is always in the inserted sequence rather than the item from the resorted index.
  I suppose this is quite a easy issue and appreciated if your team could show me some tips to solve this.

Cheers.



Replies:
Posted By: Glaber8
Date Posted: 02 December 2016 at 4:26am
I still don't make myself clear, d better show a example like this:

//----------Code---------------
//Inserting new record.
//...
m_wndReportCtrl.AddRecord(new CReportRecord(i));

MFC:
 -----------Report Control------------------
|  1  | Yes | ...
|  2  | Yes | ...
|  3  | No  | ...
 --------------------

//Click any column head, the row will resort:
 -----------Report Control------------------
|  3  | Yes | ...
|  2  | Yes | ...
|  1  | No  | ...
 --------------------

//Right now if I would like to use: (assume the focused row is third row "  1  | No  | ...".)
int nSelRow = m_wndReportCtrl.GetSelectedRowIndex();
m_wndReportCtrl.GetItemText(nSelRow, 0);

//will get the "  3  | Yes | ..." record rather than "  1  | No  | ..."




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