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

dynamic ExpandoObject in binded items with autogeneratedcolumns

Hello Syncfusion,

Here there is my situation, I have one SfDataGrid bind to a GridViewModel class (who is generic <T>) who set an ObsvervableCollection binded to his ItemCollection.
For one model object I need to add N-columns in terms of his related childs.

Here there is how I tried to do it, I parsed my collection, and for each related child, I create a dynamic object with ExpandoObject. When parse is done, I add it to an ObsvervableCollection who is copied in the binded ItemCollection.

Like this :

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var result = await this.Service.GetLstRemoteTAsync(userId);
var s       = new ObservableCollection<object>();

foreach (var benefit in (IEnumerable<Benefit>)result)
{
    dynamic service    = new ExpandoObject();
    service.Contexts   = string.Join(", ", benefit.Contexts);
    service.Code        = benefit.Code;
    service.BarCode   = benefit.BarCode;
    service.Vat           = 0.0;
    service.SubFamily = benefit.SubFamily;
   
    foreach (var modifier in benefit.Modifiers)
    {
        ExpandoHelper.AddProperty(
            service,
            "Modifier" + benefit.Modifiers.IndexOf(modifier),
            modifier);
    }

    s.Add(service)
}

this.Items = s;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

However, when it comes to generate column, the base objects displays correctly but when he arrives to complex objects he doesnt go through the method (AutoGeneratedColumn).

How can I do for display these columns ?

Thx, Alex.


1 Reply

JG Jai Ganesh S Syncfusion Team December 2, 2016 11:58 AM UTC

Hi Leclerc, 
 
We have checked your query and currently we don’t have a support to Autogenerate the complex properties. We have already logged the feature report for this. This feature will be available in any of our upcoming release. Until then you can manually add the complex property columns instead of Autogenerating the columns.   
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon