Syncfusion.Grid.Grouping.Windows
Members  Example 


GridTableDescriptor Class

Maintains schema information for a table. Collections define columns, column sets, fields, expressions, sorted, grouped columns, and related tables.
Object Model
GridTableDescriptor ClassGridTableCellAppearance ClassGridGroupOptionsStyleInfo ClassGridColumnDescriptorCollection ClassGridColumnDescriptor ClassGridColumnSetDescriptorCollection ClassGridColumnSetDescriptor ClassGridConditionalFormatDescriptorCollection ClassGridConditionalFormatDescriptor ClassGridEngine ClassExpressionFieldEvaluator ClassExpressionFieldDescriptorCollection ClassExpressionFieldDescriptor ClassFieldDescriptorCollection ClassFieldDescriptor ClassSortColumnDescriptorCollection ClassSortColumnDescriptor ClassGridRelationDescriptor ClassGridTableDescriptor ClassSortColumnDescriptorCollection ClassSortColumnDescriptor ClassRecordFilterDescriptorCollection ClassRecordFilterDescriptor ClassRelationChildColumnDescriptorCollection ClassRelationChildColumnDescriptor ClassGridRelationDescriptorCollection ClassGridRelationDescriptor ClassSortColumnDescriptorCollection ClassSortColumnDescriptor ClassSourceListSet ClassSourceListSetEntry ClassGridStackedHeaderRowDescriptorCollection ClassGridStackedHeaderRowDescriptor ClassGridSummaryRowDescriptorCollection ClassGridSummaryRowDescriptor ClassGridTableOptionsStyleInfo ClassGridGroupOptionsStyleInfo ClassUnboundFieldDescriptorCollection ClassFieldDescriptor ClassGridVisibleColumnDescriptorCollection ClassGridVisibleColumnDescriptor Class
Syntax
Example
The columns collections feature auto-populating on demand and reflect changes from the collection they depend on. The auto-population will happen when you access the contents of the collection, e.g. if you query its Count.

Of course, you can also manually initialize the Columns collection. Once you modify a collection, it will not be auto re-initialized anymore.

The following example shows how to add columns that should be displayed in the grid and initializes the width of one column:

Now that the Columns collection has been initialized manually, changes in the underlying Fields or ExpressionFields collection will not be reflected. If you now add an ExpressionField to the ExpressionFields collection, you will also need to manually add it to the Columns collection in order to display it in the grid. Suppose you added a "Total" expression to the ExpressionFields collection. You can now add this expression field to the columns collection with:

Only then new expression fields will be displayed.

If you want to force re-initialization of a modified collection, you can call the ColumnDescriptorCollection.Reset() method. Once you call Columns.Reset, the columns collection will again auto-populate all fields from the Fields and ExpressionFields collections.

The grid also supports displaying multiple rows per record. The ColumnSet collection lets you specify a multi-row per record layout in a table. A ColumnSetDescriptor holds one or multiple ColumnSpans. In a GridColumnSpan, you can specify layout information of a column. You ca,n for example, specify that the Address column should be displayed in the grid above City and Region and span these two columns: You can also manually initialize the VisibleColumns collection. The name of the GridColumnSetDescriptor identifies the column set descriptor or column in the VisibleColumns collection: A GridVisibleColumnDescriptor only has a Name property. The Name property identifies a ColumnSet or Column with the same name.

GridTableDescriptor orderDetailsTableDescriptor;
            
// Lets check the count of each collection:
Trace.WriteLine(orderDetailsTableDescriptor.Fields.Count); // returns 4
Trace.WriteLine(orderDetailsTableDescriptor.ExpressionFields.Count); // returns 0
Trace.WriteLine(orderDetailsTableDescriptor.Columns.Count); // returns 4 - will hold a column descriptor for each field in the fields collection
            
// Now, add a Expression Field.
ExpressionFieldDescriptor ed = new ExpressionFieldDescriptor("Total", "Total", typeof(double), "[UnitPrice]*[Quantity]");
            ed.DefaultValue = string.Empty;
            orderDetailsTableDescriptor.ExpressionFields.Add(ed);
            
            
// Lets check again the count of each collection:
Trace.WriteLine(orderDetailsTableDescriptor.Fields.Count); // returns 4
Trace.WriteLine(orderDetailsTableDescriptor.ExpressionFields.Count); // returns 1
Trace.WriteLine(orderDetailsTableDescriptor.Columns.Count); // returns 5 - will hold a column descriptor for each field in the fields collection and also a columndescriptor that references the expression field we just added.
GridTableDescriptor categoriesTableDescriptor = (GridTableDescriptor) engine.TableDescriptor;
            
categoriesTableDescriptor.Columns.Add("CategoryID");
categoriesTableDescriptor.Columns.Add("CategoryName");
categoriesTableDescriptor.Columns.Add("Description");
            
categoriesTableDescriptor.Columns["CategoryName"].Width = 200;
categoriesTableDescriptor.Columns.Add("Total");
GridColumnSpanDescriptor csd1 = new GridColumnSpanDescriptor("Address");
csd1.Range = GridRangeInfo.Cells(0,0,0,1);
GridColumnSpanDescriptor csd2 = new GridColumnSpanDescriptor("City");
csd2.Range = GridRangeInfo.Cells(1,0,1,0);
GridColumnSpanDescriptor csd3 = new GridColumnSpanDescriptor("Region");
csd3.Range = GridRangeInfo.Cells(1,1,1,1);
GridColumnSetDescriptor csd = new GridColumnSetDescriptor("Address_Set");
csd.ColumnSpans.Add(csd1);
csd.ColumnSpans.Add(csd2);
csd.ColumnSpans.Add(csd3);
this.groupingGrid1.TableDescriptor.ColumnSets.Add(csd);
this.groupingGrid1.TableDescriptor.VisibleColumns.Add("Address_Set");
this.groupingGrid1.TableDescriptor.VisibleColumns.Add("Phone");
this.groupingGrid1.TableDescriptor.VisibleColumns.Add("Fax");
Inheritance Hierarchy

System.Object
   Syncfusion.Design.ShouldSerializeBasedPersisterType
      Syncfusion.Grouping.DescriptorBase
         Syncfusion.Grouping.SourceListDescriptor
            Syncfusion.Grouping.TableDescriptor
               Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor

AssemblyVersion

Syncfusion.Grid.Grouping.Windows: 17.3460.0.26

See Also