How to change the order of columns in Ultragrid?The scenario is, I have a table bind in the datasource. Example:The DataTable in dataSource bind in the ultragrid consist of column 1, column2, column3, column4 & column 5 and my Problem is i want to add an extra columns in between column3 & column4 but the extra columns I want to add is not part of a dataTable in dataSource. When I view the table in Ultragrid the extra columns i added appeared after column5 and i want to insert the extra columns between column3 & column 4. please help. tnx
Should it work if positions are not 0 1 2 3 4 5 6 and so on, but 0 4 5 6 2 3 1 ?
I have a problem that VisiblePosition doesn't work. May be here is the problem?
Thank you!
Spodgy said:Does the Band insist the columns have a sequential VisiblePosition order under the hood?
Yes.
Spodgy said:If I set a column to VisiblePosition 1000 will the Visible Position change to (maxcolumns-1)?
I'm not certain what actually happens here. What you've described is the most likely scenario; otherwise, I'd expect the grid to throw an exception.
Spodgy said:If I change column 1's visible position to the same visible position of column 2, will column 2's visible position change to that of column 1?
I believe so, but I'd have to test it to be certain, and I don't have an environment set up to do so right away. The way I recall this is by picturing "removing" the column from its current position, shifting all the columns between it and the destination to fill the space, then putting the column in the destination. However, I don't recall with 100% certainty what happens when you move a column toward the "right" (increasing its visible position), and it's not a suggested approach.
Spodgy said:Is it safe to set visible positions starting with the left most column and working forwards?
Not only is this safe, this is the suggested approach. By doing this, as you set subsequent column header positions, you won't "clobber" any positions you've already set.
Hi,
I've been programmatically formatting some ultragrids using visibleposition and have been noticing some odd side effects, particularly with calculated object properties and button controls.
Does the Band insist the columns have a sequential VisiblePosition order under the hood? If I set a column to VisiblePosition 1000 will the Visible Position change to (maxcolumns-1)? If I change column 1's visible position to the same visible position of column 2, will column 2's visible position change to that of column 1? Is it safe to set visible positions starting with the left most column and working forwards?
Thanks
Jim
You can use the "VisiblePosition " property of the Header object of the desired column and set it to the desired value.
i.e.
ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.VisiblePosition = 1;
Hope it will help you.