Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to:Get Item after re-sorting.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to:Get Item after re-sorting.

 Post Reply Post Reply
Author
Message
Glaber8 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 December 2016
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Glaber8 Quote  Post ReplyReply Direct Link To This Post Topic: How to:Get Item after re-sorting.
    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.
Back to Top
Glaber8 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 December 2016
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Glaber8 Quote  Post ReplyReply Direct Link To This Post 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  | ..."

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.156 seconds.