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.

ResizeToFit performance issue

Thread ID:

Created:

Updated:

Platform:

Replies:

91813 Dec 3,2009 09:54 AM Dec 7,2010 08:07 AM Windows Forms 4
loading
Tags: Grouping
Christian Rattat
Asked On December 3, 2009 09:54 AM

Hi,

I currently resize all columns of tables and nested tables in ggc what takes a lot of time when many rows are loaded. Is there a possibility to call resizetofit on columns and consider only the visible rows to measure column widths?

We are still on version 4.2.

Thanks in advance,
Christian

Jisha Joy [Syncfusion]
Replied On December 8, 2009 01:26 AM

Hi Christian,

Thank you for posting query to us.

You could resize specific columns alone by specifying the column index in the GridRangeInfo.Col method, as argument.

this.gridGroupingControl1.TableModel.ColWidths.ResizeToFit(GridRangeInfo.Col(4));


Please let me know if this helps.

Regards,
Jisha

Ranjeet Kumar [Syncfusion]
Replied On December 8, 2009 04:42 AM

Hi Christian,

Thanks for using Syncfusion Products.

Yes, there is possibility to call resizetofit on columns and consider only the visible rows to measure column widths by passing the last visible row index and topmost row

index as arguments to ResizeToFit method. Please, refer the sample attached for its implementation and for additional GridGrouping Control optimization settings:


this.gridGroupingControl1.TableModel.RowHeights.ResizeToFit(GridRangeInfo.Rows(this.gridGroupingControl1.TableControl.TopRowIndex, this.gridGroupingControl1.TableControl.ViewLayout.LastVisibleRow));



Please find the sample from the following link in which this code has been implemented.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ResizeWidth_GGC-235102608.zip

Additionally to optimize the grid performance , you may set the following settings as shown below :

This optimization setting will help you to enhance the performance of the GridGrouping Control by utilizing less memory and so on.

// This will ensure that grid's painting routine draw all the cells with same background at one time rather than one cell at a time.
this.gridGroupingControl1.TableControl.OptimizeDrawBackground = true;

// This ensures the better memory utilization
this.gridGroupingControl1.CounterLogic = EngineCounters.YAmount;

this.gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters | EngineOptimizations.RecordsAsDisplayElements;

// Scrollwindow will cause immediate update.
this.gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate;

this.gridGroupingControl1.SortPositionChangedBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate;

this.gridGroupingControl1.Engine.InvalidateAllWhenListChanged = false;

Please, do let me know if you have any query.

Regards
Ranjeet

Christian Rattat
Replied On December 3, 2010 12:08 PM

Hello,

I'm still having problems with resizing columns to fit their content. Even if I do ResizeToFit only for the first row it takes 5 seconds when having 10000 rows in the table. This takes more time than loading the data into the grid.

I changed to version 8.2 meanwhile but the problem remains. Any ideas how to get this faster?

Regards,
Christian


Yuvaraja V [Syncfusion]
Replied On December 7, 2010 08:07 AM

Hi Christian,

Thanks you for your update.

There are some standard optimizations that need to be set, to increase the performance while using large amount of data with frequently updates in GridGroupingControl. See the following optimization code:

// Use less memory for internal binary tree structures
gridGroupingControl1.CounterLogic = EngineCounters.YAmount;
gridGroupingControl1.AllowedOptimizations = EngineOptimizations.DisableCounters | EngineOptimizations.RecordsAsDisplayElements;

// Affected settings by UseDefaultsForFasterDrawing are: InvalidateAllWhenListChanged, TableOptions.ColumnsMaxLengthStrategy, TableOptions.GridLineBorder,TableOptions.DrawTextWithGdiInterop, TableOptions.VerticalPixelScroll,Appearance.AnyRecordFieldCell.WrapText and Appearance.AnyRecordFieldCell.Trimming.
gridGroupingControl1.UseDefaultsForFasterDrawing = true;

// Instruct grouping control not to access datasource through CurrencyManager API and instead access list diretly. When set to false you wil however loose support for built-in CurrencyManager synchronization, so only do this if you don't need CurrencyManager synchronization.
gridGroupingControl1.BindToCurrencyManager = false;

// Update display with changes, optionally use ScrollWindow for insert and removing rows.
//gridGroupingControl1.UpdateDisplayFrequency = 0; // only manual updates (when you call grid.Update)
gridGroupingControl1.UpdateDisplayFrequency = 1; // immediate update after each ListChanged.
//gridGroupingControl1.UpdateDisplayFrequency = 100; // update every 100 ms.
gridGroupingControl1.InsertRemoveBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate; // Scrollwindow will cause immediate update.
gridGroupingControl1.SortPositionChangedBehavior = GridListChangedInsertRemoveBehavior.ScrollWithImmediateUpdate; // Scrollwindow will cause immediate update.

// Don't forget this property. If it is true then InsertRemoveBehavior and SortPositionChangedBehavior properties would have no effect at all. Its default value is false if UseDefaultsForFasterDrawing = true has been set, but setting it explictly makes sure this is false.
gridGroupingControl1.InvalidateAllWhenListChanged = false;


You could refer the following sample from sample browser for more details:
..\syncfusion\essentialstudio\8.2.0..\Windows\Grid.Grouping.Windows\Samples\2.0\PerformanceSamples\GroupingPerf\cs

Please let me know if this helps.

Regards,
Yuvaraja V.



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.

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.

;