RptCtrl: Programatically set column order |
Post Reply |
Author | |
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
Posted: 23 December 2004 at 12:44am |
The issue: We want the fields in the Report Control FieldChooser to appear sorted alphabetically.
In order to achieve this, the columns are added to the report control in alphabetical order (no problem, other than having to destroy and recreate the field chooser, if it is visible, every time a column is removed by the user since the removed column name will not appear sorted in the field chooser list. But, that is another issue). However, the desired _default_ Column Order for this application is NOT alphabetical order. Am I just missing something or is there really no way to programmatically set the column order other than to perform a SaveSettings after dragging the column headers to the desired configuration and then use the saved data in a call to LoadSettings on the initial startup of the application? |
|
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Hummmmm......
Do these guys answer all of the questions posted here, or do they only answer the easy ones? <g> The lack of a timely response certainly doesn't make one feel much like recommending the product.... |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
Typically questions are answered fairly quickly. In the past, I've had posts go for months without a response. I don't know if it was because they were overlooked or because they didn't have an answer. You may want to email support directly if you need a more immediate response. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Maybe this is what you are looking for?
This is cut and paste from the help file: This sample illustrates how to sort the columns in the ReportControl. If you had 8 columns added to the ReportControl, this sample would sort the columns first by the column at Itemindex 7, then by the column at ItemIndex 2, then by the column at ItemIndex 5.
|
|
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
>Maybe this is what you are looking for?
Nope, I'm not looking for sort order but rather, *column* order i.e. which columns appear, in order, from left to right in the control (column(5) in position 1, column(7) in position 2, column(1) in position 3, column(12) in position 4 & etc...). Have you provided a method to accomplish this programmatically? |
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
For the record, this is something I'm interested in as well. I had assumed that ReportControl would offer this basic functionality, so I was disappointed to find out that it did not. Programmatically setting column order is very important. I'd like to provide an interface similar to Outlook that allows the users to use a dialog to control which columns are visible and in which order. Without being able to change column order myself, this simply can't be done. It looks like having a 'SortAscending' property in the FieldChooser should also be added. Sorted alphabetically is the default order for fields in the Outlook FieldChooser. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Have you tried to delete the columns then add them back in the order
you want? You would need to keep track of the item index, as it
is the index of the item in the record to show in the column.
|
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
I haven't tried it, but I don't think it will work. The ItemIndex is assigned based on the order the columns are added to the ReportControl. If you delete them all and add them back in a different order, the ItemIndex for the columns will probably change (since they are being added in a different order than originally added) and will no longer correspond to the ReportRecordItems. I don't there's going to be any acceptable workaround for this, so new functionality will need to be added. You would think you could just change the 'Index' of a column to alter it's position, but this property is Read Only (even though the Documentation says it's a Read-Write Property ). I hope a solution for this can be provided in the next release of ReportControl. The ability to modify column positioning already exists (since you can drag/drop), so we just need to have it exposed programmatically. |
|
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
>I hope a solution for this can be provided in the next release of ReportControl. The ability to modify column positioning already exists (since you can drag/drop), so we just need to have it exposed programmatically.
I agree and was pretty surprised that this basic functionality was omitted from the control. Also, as long as we're asking for features, another thing the report control *really* needs is a virtual mode. Let us back the list with whatever storage we want and just ask us for the data when the control needs to draw an item. It's insane to have to create an object for each cell in the display. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Virtual mode is going to be added next release
|
|
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
>Virtual mode is going to be added next release
That's good news. So, the obvious follow-up question is..... When will that be? |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Hopefully by the end of January
|
|
alpine
Newbie Joined: 23 December 2004 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Cool! Do you need another beta tester? I'm in the process of doing a prototype that would be a great test-bed for the virtual report control and the timing for release would be just about perfect.
|
|
Boyd
Senior Member Joined: 08 December 2003 Location: United States Status: Offline Points: 285 |
Post Options
Thanks(0)
|
I was told that a 'Move' method was added for the next release
|
|
wrecks
Groupie Joined: 14 July 2015 Status: Offline Points: 42 |
Post Options
Thanks(0)
|
Many years later, I had the same question.
The answer is: use the Column.Move method. Example: Columns.Find(7).Move(1) Means move the column with ItemIndex 7 to Index 1. |
|
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 |