Display Properties of Complex objects

Hello, I am trying to display complex object models in a Pivot Table but am having trouble accessing child objects. 

For example if I have the following:

<SfPivotView TValue="MultiOrderProduct" Height="900">
    <PivotViewDataSourceSettings DataSource="@_dataSource" ExpandAll="true">
        <PivotViewRows>
            <PivotViewRow Name="ID"></PivotViewRow>
            <PivotViewRow Name="ProductA"></PivotViewRow>
            <PivotViewRow Name="ProductB"></PivotViewRow>
        </PivotViewRows>
        <PivotViewValues>
            <PivotViewValue Name="ID" Caption="Parent ID"></PivotViewValue>
            <PivotViewValue Name="Price" Caption="ProductA Price"></PivotViewValue>
            <PivotViewValue Name="Price" Caption="ProductB Price"></PivotViewValue>
        </PivotViewValues>
    </PivotViewDataSourceSettings>
</SfPivotView>


@code {
    public List<MultiOrderProduct> _dataSource { get; set; } = new List<MultiOrderProduct>();


    protected override void OnInitialized()
    {
        var product = new MultiOrderProduct()
            {
                ID = 0,
                ProductA = new Product() { ProductName = "Shirt", Price = 20 },
                ProductB = new Product() { ProductName="Coat", Price = 100 }
            };


            _dataSource.Add(product);
    }


    public class MultiOrderProduct
    {
        public int ID { get; set; }


        public Product ProductA { get; set; }
        public Product ProductB { get; set; }
    }


    public class Product
    {
        public string ProductName { get; set; }
        public decimal Price { get; set; }
    }
}

The pivot table is displaying only displaying the object name of ProductA and ProductB and also placing ProductB as a nested item under ProductA instead of the parent MultiOrderProduct. 

How am I able to access and display child objects in a pivot table like this. 


Thank you,


1 Reply

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team August 15, 2022 11:16 AM UTC

Hi Leland,


Based on the current architecture, this requirement is not feasible in the pivot table component. We don’t have support to bind complex JSON data source in our pivot table. Kindly refer to the following document to know more about supported data sources.


Document: https://blazor.syncfusion.com/documentation/pivot-table/data-binding


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon