Quantcast
Viewing all articles
Browse latest Browse all 7205

How to keep master and detail view column widths synchronized


When you have a master-detail view and for some reason don't want to use the AutoColumnWidth option, the detail view is still stretched to accommodate the entire master view's width. So, in this example we've decided to create a grid view that changes this behavior and synchronizes the detail view's width with the mater view's columns.
We create and register a GridView descendant that introduces the AutoSynchronizeDetailsLayout option by using a descendant of the GridOptionsView class. If this option is enabled and the AutoColumnWidth option is disabled the new behavior takes effect. The detail view's width is now calculated based on the master view columns' width, so, the detail view ends up with the last master view's column.
In addition, if the number of detail and master view columns is equal, the detail view's columns are aligned with that of the master view for even a smoother view.

Example Comments

Added By: andrei shannou at: 8/9/2013 5:46:31 AM    

Thanks,

It works, but a little buggy. Try to group a grid by any column, then change the width of any column. I seems to fall in infinite loop. Tried to find out why, but failed. Will appreciate your help if any.

Added By: andrei shannou at: 8/9/2013 6:39:35 AM    

Got it. Should be

                        rowVisibleIndex = GetNextVisibleRow(rowVisibleIndex);
                        rowHandle = GetRowHandle(rowVisibleIndex);

Added By: andrei shannou at: 8/9/2013 7:00:51 AM    

by the way, horizontal scrolling is also broken :-(


Viewing all articles
Browse latest Browse all 7205

Trending Articles