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. Image for the cookie policy date
close icon

ResizeToFit performance issue

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

4 Replies

JJ Jisha Joy Syncfusion Team December 8, 2009 06:26 AM UTC

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


RK Ranjeet Kumar Syncfusion Team December 8, 2009 09:42 AM UTC

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


CR Christian Rattat December 3, 2010 05:08 PM UTC

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



YV Yuvaraja V Syncfusion Team December 7, 2010 01:07 PM UTC

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.



Loader.
Live Chat Icon For mobile
Up arrow icon