I am using WinGrid version 8.2.20082. The requirement for our project was that one database row appear as two rows in the grid. The natural solution is use either RowLayout or Groups and Levels. We started down the path of using RowLayout but unfortunately when you use RowLayout you no longer have the ability to programmatically order the columns. We then shifted our focus to Groups and Levels. This actually works much better except for I have run into an issue when trying to use Groups and Levels with a grid that is bound to a hierarchical dataset. Our use case is that a single child row of the hierarchical dataset appear as two rows in the grid. I am able to use the Groups and Levels function at design time to set the layout but the layout is not honored at runtime. Is this something that is not supported by the grid or have I setup the child rows of the grid incorrectly at design time.
JackCollett said:unfortunately when you use RowLayout you no longer have the ability to programmatically order the columns
This is not true. Of course you can programmatically control the order of the columns. It's just a little more complex in a RowLayout, since you have to work with the column.RowLayoutColumnInfo and the OriginX, OriginY, SpanX, and SpanY.
JackCollett said:I am able to use the Groups and Levels function at design time to set the layout but the layout is not honored at runtime. Is this something that is not supported by the grid or have I setup the child rows of the grid incorrectly at design time.
If you set up the layout at design-time, you have to be sure that the Keys of each Band and each column matches the run-time datasource exactly. This KB article should help:
HOWTO:How can I define columns in the grid at Design-time and bind them at run-time so that some fields of the data are excluded from the grid?
Hi Mike,
I think I misspoke. Via chat the tech support staff told me it was not possible to use VisiblePosition (???) to set the column position when using RowLayout. For clarification if I have two colums A and B and I want to swap these columns using Row Layout would my pseudocode look like the following:
ColB.OriginX = 1, ColB.SpanX = 5, ColB.OriginY = 5, ColB.SpanY = 5
Meaning would this automtically slide column A to the right by 5 or would you have to manually move column A as well?
The problem I see with this is that we have upwards of 80 columns in the grid. 50 of which are price and megawatt data (1 data point corresponding to each hour of the day) which have to appear with the Megawatt value for hour 1 on top of the price value for hour 1. You can see how using the RowLayoutColumnInfo could be tedious.
Thanks,
Ryan
Hi Ryan,
That's correct, you can't use VisiblePosition once you set the Origin on a column. If you leave the OriginX and OriginY set to the default, then the VisiblePosition is actually used. But that will not help you here since you want data on more than one level.
It's usually easier to set up the RowLayout at design-time using the grid designer. But if you wanted to set this up in code, the code you have here would have no effect on Column A - it's only setting properties on Column B.