Add PivotFields dynamically

Hi.

I am wondering if it is possible to add PivotFields dynamically to a PivotGrid without using CodeBehind. Either from a dynamic expando object or from a list of dynamic properties.

My current implementation does like the following in CodeBehind:

if (HasDimensionType(debitRows, DimensionType.employee_id))
{
    this.PivotGrid.PivotFields.Add(new PivotItem
    {
        FieldMappingName = "EmployeeIdDimensionText",
        FieldHeader = "Anställningsnummer",
        TotalHeader = "Total"
    });
}

1 Reply

NR Niranchana R Syncfusion Team October 22, 2013 06:36 AM UTC

Hi Alexander,

 

We would like to inform you that we have created a simple sample to add Pivot Fields dynamically to a PivotGrid from a list containing dynamic properties. Please download the sample from the following link.

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/PivotFields847233038.zip

 

In the above sample, we used a separate button which adds Pivot Field dynamically to PivotGrid Control.

 

Please let us know if any queries.

 

Regards,

Niranchana



PivotFields_bfaeaa1f.zip

Loader.
Up arrow icon