I have a grid bind to a dataset having two tables with parent child relationship. Both tables have same number of column. Grid display the tables in hierarchical view in two bands. I hide the column headers for second band. I also set the AllowColSizeing property to Syncronized to get a behavior that if I resize any column in first band, respective column in second band must be resized. But I am unable to achieve this behavior.
I want syncronized behavior for all bands in ultra wingrid. Mean to say that if i resize any column in parent band, respective column in child band also be resized to same size. But I am unable to get this behavioir. I explicitly set the sizing property to syncronized but no solution yet.
“Synchronized” means that columns in child rows collections under different parent rows will be sized at once. This has nothing to do with different columns in parent and child band. How are you going to decide which columns in the parent and child band should be synchronized? By key? By caption? These things can be the same for two columns but it is still possible that these columns have complete different data and should not be synchronized.
I guess, you need to implement this special behavior where it is appropriate for you. I would suggest to look to AfterColPosChanged event in UltraGrid.
Perhaps I was unable to describe my problem fully.
Scenario is that my two bands have same number of columns and data. One band is associated to one table and other one is associated to a different table. I defined same columns for two bands using same keys for columns. Now I want the required behavior as i describe above. I assume that if both bands have same column at same postion with matching key, then there resizing must be syncronized.
Unfortunately the assumption is wrong. Imagine, you have two tables: Manager (parent table) with columns Name and Salary, and Employee (child table) with the same columns.How can the grid know whether Manager's salary and Employee's salary should be synchronized? It is definitely not achievable with a simple enumeration property.
If Mike doesn't have some brilliant idea, I guess the best way is AfterColPosChanged event
Thanks Mike for replies and help,
I build a new test project to test simple behavior of AllowColSizing property for multiband grid and that works fine. It meas that some where in my form i am resetting this property to None. But I am unable to find that location. Anyways, thanks for all your support and help.
I'm a little confused by your description. In particular, steps 1 and 2.
By default, the first column in band 0 and the first column in band 1 will have the same right edge. The second column in band 0 will have the same left and right edges as the second column in band 1. So setting the width of the columns in band 0 will automatically adjust the width of the columns in band 1.All of the columns in band 0 will be the same width as the columns in band 1, except for the first column which will have a slightly different width due ot the indentation of the band.
So in a case like this, it doesn't make sense to set the width of the columns in band 0 and the width of the columns in band 1, becuase setting one will affect the other.
If this is not the behavior you are getting, then something is wrong. Either you are setting AllowColSizing somewhere else to a value other than Synchronized, or you use using RowLayouts, or maybe loading a layout into your grid that is setting AllowColSizing.
Anyway, I think I have said all that before and we seem to just be going in circles at this point, so I recommend that you create a small sample project demonstrating the behavior you are getting and Submit an incident to Infragistics Developer Support so they can check it out and see why it's not working.
Thanks Mike/Andrej,
Yes I want to move 2 splitters simultaneously. What I am doing with grid layout is
1. Define band(0) columns width,
2. Define band(1) columns width,
3. Define band(0) columns header captions.
4. Define band(0) columns header captions' text allignment.
5. Define band(0) columns header captions.
And after all that, following code is for display layout
Me.grdProducts.DisplayLayout.Override.HeaderPlacement = HeaderPlacement.FixedOnTop Me.grdProducts.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect Me.grdProducts.DisplayLayout.Override.SelectTypeRow = SelectType.SingleAutoDrag Me.grdProducts.DisplayLayout.Override.RowSizing = RowSizing.AutoFixed Me.grdProducts.DisplayLayout.Bands(0).Columns(DG_CHECKBOX_COL).CellClickAction = CellClickAction.Edit Me.grdProducts.DisplayLayout.Override.ColumnAutoSizeMode = ColumnAutoSizeMode.VisibleRows Me.grdProducts.DisplayLayout.Override.AllowColSizing = AllowColSizing.Synchronized Me.grdProducts.DisplayLayout.RowConnectorStyle = RowConnectorStyle.Default Me.grdProducts.DisplayLayout.Bands(0).Override.RowSelectors = DefaultableBoolean.True Me.grdProducts.DisplayLayout.Bands(1).Override.RowSelectors = DefaultableBoolean.True
I am not using any row layout for my grid.
I apologize for confusion. The behavior I've described is actually for AllowColSizing = Free. See screenshot below
AllowColSizing = Synchronized means that all 4 splitters will be moved simultaneously.
AllowColSizing = Free means, that splitters 1 and 3 are independent from splitters 2 and 4. But 1 will be moved together with 3, and 2 together with 4.
May be you have some other columns in one of the bands? Or they are ordered differently?
Hi Habib,
Your assumption is correct and once again, even without setting ColSizing, this is the default behavior of the grid. The columnsin each band of the grid have their sizes synchronized by default. There's no problem with the grid figuring out which column to synchronize with which, it just goes by the visible order of the columns.
I don't know why this is not working for you, unless something in your code is loading a layout or setting the ColSizing property in some other way. Or maybe you are using RowLayouts? I don't think ColSizing has any effect on RowLayouts. If that's the case, then Andrej would be correct, the grid can't synch up columns in a RowLayout, because there really are no actual columns, only virtual columns and they can be arranged vertically as well as horizontally. If that's the case, you would have to handle an event of the grid, like AfterLayoutItem Resized and size the appropriate item in the other band accordingly.