Hi together,
I have a dataset with multiple colums. Now I want to autosize the columns of table "A"
grGrCo_SeqDef.GetTableDescriptor("A").AllowCalculateMaxColumnWidth = false;
GridTableModel tm = grGrCo_SeqDef.GetTableModel("A");
tm.Table.FilteredChildTable = null;
tm.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders);
So the code above does autosizing of all columns, but not correctly. Let''s assume I have in column "Name" of table "A" a value like "This is just a test" then I can''t see the whole value.
What I am doing wrong?
Cheers,
Markus
AD
Administrator
Syncfusion Team
August 19, 2005 12:22 PM UTC
Try including this flag in the GridResizeToFitOptions, IncludeCellsWithinCoveredRange.
model.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders | GridResizeToFitOptions.IncludeCellsWithinCoveredRange);
AD
Administrator
Syncfusion Team
August 19, 2005 12:54 PM UTC
Hmm, no this doesn''t work. Only my last column gets
wider, but this one doesn''t include the long cell value. The long cell value is in the first column and this one doesn''t get wider.
Any ideas?
Cheers,
Markus
>Try including this flag in the GridResizeToFitOptions, IncludeCellsWithinCoveredRange.
>
>model.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders | GridResizeToFitOptions.IncludeCellsWithinCoveredRange);
>
AD
Administrator
Syncfusion Team
August 19, 2005 01:22 PM UTC
It seems to work for me in this sample using the 3.3 RC. The button click sizes the ChildTable.
http://www.syncfusion.com/Support/user/uploads/GGC_MinimalNestedtables_b0e08cfe.zip
Can you see a problem in this sample?
AD
Administrator
Syncfusion Team
August 19, 2005 01:33 PM UTC
Thanks for your example - I will have a closer look at it.
AD
Administrator
Syncfusion Team
August 21, 2005 02:31 PM UTC
Thanks - the example works great.
But I have another question. I want the grid to fill the client area of the gridgroupingcontrol (so that the columns fill the complete area) - and additional I want the autosize feature of the columns (to fit the cell content). Furthermore the grid is bound to a dataset with 4 tables and so the issues above should work for each table - How can this be done? Is there a small code sample available??
Any help would be great - Thanks in advance
Cheers,
Markus
AD
Administrator
Syncfusion Team
August 22, 2005 09:25 AM UTC
I do not really have a good solution for this. Here is a try at sizing the last column as the grid is displayed. http://www.syncfusion.com/Support/user/uploads/fillrightcolGGC_3da492c.zip