We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC - Auto resize column width based on contents

Thread ID:

Created:

Updated:

Platform:

Replies:

35222 Sep 26,2005 04:51 PM Sep 28,2005 07:29 PM Windows Forms 3
loading
Tags: GridControl
Nancy Jan
Asked On September 26, 2005 04:51 PM

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

Administrator [Syncfusion]
Replied On September 27, 2005 05:11 AM

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

Nancy Jan
Replied On September 28, 2005 11:11 AM

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

Administrator [Syncfusion]
Replied On September 28, 2005 07:29 PM

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 >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;