DC
Daniel Chait
July 21, 2004 12:44 PM UTC
More specifically, when I call
gridGroupingControl1.TableDescriptor.Fields.Add("CalculatedPrice.Value");
it doesn''t change the table''s appearance, as expected. However when I call:
gridGroupingControl1.TableDescriptor.Columns.Add("CalculatedPrice.Value");
It removes all the columns from the table and just adds that one.
AD
Administrator
Syncfusion Team
July 21, 2004 01:03 PM UTC
Hi Daniel,
regarding your sample:
Before you add
gridGroupingControl1.TableDescriptor.Columns.Add("CalculatedPrice.Value");
do
int count = gridGroupingControl1.TableDescriptor.Columns.Count; // forces auto population
gridGroupingControl1.TableDescriptor.Columns.IsModified = true; // forcess keeping all auto-populated columns
That way you signal the grid that you want to keep the auto-populated set of columns as it is and start modifying the collection. If it is not marked modified the columns collections assumes you do not want to keep the auto-populated set of columms.
Once the columns collection was marked modified it will not autopopulate any more. You will need to manually add fields to the columns collection after that.
Check out the GridTableDescriptor overview in class reference. (Should be at ms-help://Syncfusion.EssentialSuiteClassRef/Syncfusion.EssentialSuiteClassRef/Syncfusion.Grid.Grouping~Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.html)
The Fields collection is auto-populated from the underlying sourcelists columns. Normally you will not modify this collection and just use it in its default auto-populated state. A fieldDescriptor holds a name, mapping name and type of the column in the list.
The Columns collection lets you specify the fields that should be displayed in the GridTableControl. By default the Columns collection is auto-populated from the underlying Fields and ExpressionFields collection and will be a combination of this two collection. When the Columns collection is autopopulated and you make changes to the Fields or ExpressionFields collection this changes will automatically be reflected in this collection.
GridColumnDescriptors in the Columns collection have a reference to a FieldDescriptor (or ExpressionFieldDescriptor).
Additionally GridColumnDescriptors contain grid-specific information about a column such as the column width. You can manually set the column width or have it be automatically initialized by the grid to fit the string with the maximum length in the columns data. GridColumnDescriptor also has a Appearance property. This is where cell type and formatting of the column can be specified.
Stefan
DC
Daniel Chait
July 21, 2004 03:03 PM UTC
Thanks for the overview.