Hi,
I''ve tried to dig through everywhere in vain to find the method to automatically resize column width based on the contents in the GGC. Could someone please tell me what''s the method to use?
Thanks in advance,
NJ
AD
Administrator
Syncfusion Team
September 27, 2005 09:11 AM UTC
Hi NJan
You can use the following code to automatically resize column width based on the contents in a GGC.
this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit();
You can specify the arguments to mention the range .
Thanks
Mouli
NJ
Nancy Jan
September 28, 2005 03:11 PM UTC
Hi Mouli,
How does ResizeToFit work? Will it impose a performance hit? What if we also want to set a maximum column size? What is the most efficient way to code this as we tend to have large amount of data to display (up to 500,000 rows * 20 columns).
Thanks,
NJ
AD
Administrator
Syncfusion Team
September 28, 2005 11:29 PM UTC
Hi NJ,
in a GridGroupingControl you should better use the GridTable.GetColumnMaxLength method to determine the number of characters in a column or the GetPrefferedColumnWidth method. GetPrefferedColumnWidth lets you pass in a maximum width. The result can then be used to modify GridColumnDescriptor.Width.
But by default the engine will actually do the sizing for you automatically.
Ilf you want to display 500000 records you should change the default algorithm for calculating the column width.
This can be done with these settings:
Engine.TableOptions.ColumnsMaxLengthStrategy =
GridColumnsMaxLengthStrategy.FirstNRecords;
grid. Engine.TableOptions.ColumnsMaxLengthFirstNRecords = 100;
BTW - If you want to display 500000 record you should also use these settings:
grid.Engine.AllowedOptimizations = EngineOptimizations.All;
grid.Engine.CounterLogic = EngineCounters.FilteredRecords;
grid.Engine.TableOptions.VerticalPixelScroll = false;
Stefab
>Hi Mouli,
>
> How does ResizeToFit work? Will it impose a performance hit? What if we also want to set a maximum column size? What is the most efficient way to code this as we tend to have large amount of data to display (up to 500,000 rows * 20 columns).
>
>Thanks,
>NJ
>