Populate expands child items |
Post Reply |
Author | ||
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
Posted: 09 April 2007 at 10:45am |
|
Is there any way to prevent Populate() from changing the collapsed state of child items in the report control?
This behavior can be reproduced in the ReportSample application.
1) Right-click on any group item and choose "Collapse All Groups"
2) Expand "From: Bruce Wayne" group.
3) Click on checkbox on the far right of the "Bruce Wayne" item.
All groups expand after you click the checkbox.
In my application I have many child items and the user expects the collapsed states to be retained upon application restart. Whenever an item is added, renamed, or deleted Populate() is called. This causes all child items to expand which is quite annoying to the user.
Thank you.
|
||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|
Hi,
This is actually a known problem. Unfortunately it's not easy to solve it in terms of Populate logic, but there is another way (as I see it) -- having methods which will add or remove records on the 'fly' (update rows structure without Populate call). Methods for such remove on the 'fly' have been already added to version 11.1.0 (which is coming soon):
We plan to add other 'on the fly' method CXTPReportControl::AddRecordEx in the nearest future. In these terms, task with updating a single record (like changing a checkbox) will look like:
-- Regards, Sergey |
||
bschaer
Groupie Joined: 27 June 2006 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
|
Desperately need the "AddRecordEx" logic you have eluded to.....
Much thanks
|
||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|
Next version will include it.
-- WBR, Serge |
||
bschaer
Groupie Joined: 27 June 2006 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
|
The logic you have outlined for updating record data does not work with 11.2.0 because on the RemoveRecordEx call, the record is deleted upon InternalRelease. So I wrapped the Remove/Add with AddRef/Release (below) and this creates a new problem with the row logic at XTReportRow.cpp line 814 (ASSERT(m_pParentRows->GetAt(m_nChildIndex) == this);
When only one record is added/updated, no ASSERT triggered. On second record added then updated you get it.
I need on the fly inserts and updates without using Populate. The updates need to perform resort/regroup as necessary and I believe you have coded that way.
This is a critical situation that I need resolution on soon. Thanks.
For new record:
CMyReportRecord* pNew = new CMyReportRecord();
pRecord->m_pSomeItem->SetValue(SomeInitialValue); GetReportCtrl().AddRecordEx(pNew);GetReportCtrl().RedrawControl();
For update record:
pRecord->m_pSomeItem->SetValue(SomeNewValue);
pRecord->InternalAddRef();
GetReportCtrl().RemoveRecordEx(pRecord);
GetReportCtrl().AddRecordEx(pRecord);
pRecord->InternalRelease();
|
||
bschaer
Groupie Joined: 27 June 2006 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
|
Firstly, it seems to me that the AddRecordEx should be doing a InternalAddRef() to balance the InternalRelease done within RemoveRecordEx. Beyond that, I have not yet worked thru the Row array logic to understand what is leading to the line 814 assert.
|
||
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
|
Hi,
Hope adding the following update into the code of RemoveRecordEx in bold will fix the problem:
-- WBR, Serge |
||
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 |