Custom derived GGC shows blank rows

Hi all!

I have derived GridGroupingControl, which creates all others controls as instances of nested classes (GridEngine<T>, derived from GridEngine etc)
For GridColumnDescriptor customizations i use some local attributes (VisiblePosition, Hidden, and others)
After assigning ICollection<T> to MscoGrid.DataSource i recieve straight number or rows and columns, but all table cells are empty.

In attached file -- simple dummy GridGroupingControl implementation.

And now question, what exactly i missed? What kind of events i have to listen, or DataSource have to be binded manually to fill cells?





Attachment: GridBase_d94e6fb1.zip

3 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team March 22, 2018 01:09 PM UTC

Hi Alexey, 

Thanks for your interest in Syncfusion products. 

We have analyzed your sample code and prepared the simple sample as per the given code. In your code, the GridTableDescriptor is not set and Name of GridColumnDescriptor is not set while adding columns in GridColumnDescriptorCollection. So that the cell values are not populated properly. As per our grid structure, if column name is not valid, that column will not be added in GridColumnDescriptorCollection. Please refer to the below code snippet and sample, 

Code example: 
InstanceColumnDescriptorCollection Class: 
 
internal class InstanceColumnDescriptorCollection : GridColumnDescriptorCollection, IItemType 
{ 
    private Type _itemType; 
 
    public InstanceColumnDescriptorCollection(Type itemType, MscoTableDescriptorBase mscoTableDescriptorBase) 
    { 
        //Set GridTableDescriptor using reflection. 
        var methodInfo = this.GetType().GetMethod("SetTableDescriptor", BindingFlags.NonPublic | BindingFlags.Instance); 
        methodInfo.Invoke(this, new object[] { mscoTableDescriptorBase }); 

 

MscoGridColumnDescriptor class: 
 
internal MscoGridColumnDescriptor(MscoPropertyDescriptor mscoPropertyDescriptor) 
    : base(mscoPropertyDescriptor) 
{ 
     
    HeaderText = mscoPropertyDescriptor.HeaderText; 
    Appearance.AnyRecordFieldCell.Font.Size = 8; 
    Appearance.AnyRecordFieldCell.Font.Facename = "Consolas"; 
    Appearance.AnyRecordFieldCell.CellValueType = mscoPropertyDescriptor.FieldPropertyType; 
    Appearance.ColumnHeaderCell.Font.Size = 9; 
    Appearance.ColumnHeaderCell.Font.Facename = "Consolas"; 
    MappingName = mscoPropertyDescriptor.MappingName; 
    //Set name for column. 
    _name = mscoPropertyDescriptor.Name; 
 

Sample link: 

Regards, 
Piruthiviraj 



AK Alexey Kokovin March 22, 2018 04:55 PM UTC

Works like a charm! Thank you!

Could you give me one more advice: i want to get interface-based row appearances, what is the best method to receive this? to handle QueryCellInfo?



SN Sindhu Nagarajan Syncfusion Team March 25, 2018 03:51 PM UTC

Hi Alexey, 

Thanks for the update. 

 In GridGrouping control, a custom style can be created by inheriting GridStyleInfo class but there is no  direct support  to use the properties of the class in the custom class. So we suggest you to use apply style to the grid using GridStyleInfo. 

Please let us know if you have any other queries. 

Regards, 
Sindhu   


Loader.
Up arrow icon