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

AllowCalculateMaxColumnWidth

I am encountering an issue with the GGC and was wondering if someone can shed some light on it.

I am currently using Syncfusion 7.403.0.20, although it looks like this issue exists in the previous releases as well (specifically 7.1 and 7.3).

While using the GroupingPerf sample that is provided with Syncfusion, I have been encountering performance issues regarding usage of the AllowCalculateMaxColumnWidth property.
I am trying to load a DataTable that is 500,000 rows x 100 columns in a flat grid (there is no grouping currently).
With the AllowCalculateMaxColumnWidth property set to false or not explicitly set, the grid loads fairly quickly, with the vast majority of the time being taken up by the actual loading of the DataTable.
The painting operation with this many rows is fairly performant, taking less than 2 seconds to paint. When the AllowCalculateMaxColumnWidth property is explicitly set to true, the grid takes forever to load, in excess of 5 minutes.
What baffles me is that it appears that the default value for AllowCalculateMaxColumnWidth is true, with the strategy defaulting to MaxLengthSummary, even when AllowCalculateMaxColumnWidth is not explicitly set to true. This is also confirmed by the fact that the columns are still automatically sized when not explicitly setting AutoCalculateMaxColumnWidth to true. The resulting visual appearance whether setting it to true or not explicitly setting it appears to be the same.
Why then does it take so much longer when explicitly setting this property, even though it looks like this is the default setting?


Another issue that I just found that relates to my previous issue:
When using the VirtualMode optimization and setting the AllowCalculateMaxColumnWidth property to false or not explicitly setting it, and then clicking the "Insert Records" button, the rows are inserted into the DataTable, but the DisplayElement count does not increase and the records are not displayed in the grid. The following exception is thrown and then handled within the syncfusion code:
catched at Syncfusion.Grouping.Table.NewBindingList_ListChanged(Object sender, ListChangedEventArgs e) in :line 0
Count = 20305 FilteredRecordCount = 20305 YAmountCount = 0
Count = 20002 FilteredRecordCount = 20000 YAmountCount = 360022
System.ArgumentOutOfRangeException: Count = 20305 FilteredRecordCount = 20305 YAmountCount = 0 out of range Count = 20002 FilteredRecordCount = 20000 YAmountCount = 360022
Parameter name: searchPosition
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter start, ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 cookie, Boolean preferLeftMost)
at Syncfusion.Grouping.Internals.ElementTreeTable.GetEntryAtCounterPosition(ITreeTableCounter searchPosition, Int32 counterKind, Boolean leftMost)
at Syncfusion.Grouping.Internals.ElementHelper.GetEntryAtCounterPosition(Element el, ITreeTableCounter counter)
at Syncfusion.Grouping.Internals.ElementHelper.__FindElement(Table _table, ITreeTableCounter index, Type t, Boolean stepInNestedTables)
at Syncfusion.Grouping.RecordsInTableCollectionBase.get_Item(Int32 index)
at Syncfusion.Grouping.UnsortedRecordsCollection.get_Item(Int32 index)
at Syncfusion.Grouping.Table.OnSourceListItemAdded(Object sender, ListChangedEventArgs e, TableListChangedEventArgs te)
at Syncfusion.Grouping.Table.NewBindingList_ListChanged(Object sender, ListChangedEventArgs e)

These records will not be painted until a column is sorted or the table is rebound, calling grid.Update() or Refresh() does not cause the new records to be painted. When the AllowCalculateMaxColumnWidth property is explicitly set to true in conjunction with VirtualMode and records are inserted, they are displayed correctly when the insert operation completes and no exceptions are thrown.

1 Reply

RK Ranjeet Kumar Syncfusion Team December 3, 2009 01:49 PM UTC

Hi Mike,
Thanks for using Syncfusion Products.

To enable the insertion of new records and gtting displayed in the GridGroupingContro when using the VirtualMode optimization and setting the AllowCalculateMaxColumnWidth property to false , you need to mark the table as dirty as well as refresh the grid. The same has been displayed using the sample shown below. To implement the same, buttonInsertRecords_Click event has been handled


// Event buttonInsertRecords_Click

// When a table is marked dirty, the subsequent access of its elements will trigger the recategorization of the of all records in the table.

ggc.Table.TableDirty = true;

// this will redraw the parent control and any child control
ggc.Refresh();




In response to your another query related to AllowCalculateMaxColumnWidth, its default value is false. Means, when set to false all the columns will have same width
as oppose to when set to true, where the column with will get adjust according to the length of the character in that particular column.
Try setting the property ,


this.grid.TableDescriptor.AllowCalculateMaxColumnWidth = true;


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=AllowCalculateMaxColumnWidth_In_GGC-310474874.zip

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


Regards
Ranjeet

Loader.
Live Chat Icon For mobile
Up arrow icon