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"
    });
}

4 Replies

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


DM Denis Mikulich December 31, 2025 03:02 PM UTC

Hi there, this example link doesn't work. Can I get this example as well? It is crucial for my project to add fields in runtime.

Thank you!

Denis M.



SR Senthilkumar Ranganathan Syncfusion Team January 2, 2026 01:38 PM UTC

Hi Denis Mikulich,

We have reviewed the reported scenario and are currently preparing a sample to add the pivot fields dynamically. We need some time for validation and will provide further updates on or before January 6, 2026.

Regards,
Senthilkumar Ranganathan.



SR Senthilkumar Ranganathan Syncfusion Team January 6, 2026 02:29 PM UTC

Hi Denis Mikulich,

The sample referenced in the forum was missing in Direct-Trac, which prevented it from being downloaded. We have now provided the sample, kindly review it and let us know if you have any concerns. Please share the details along with your expectations, and we will be happy to assist you.

Regards,
Senthilkumar Ranganathan.

Attachment: PivotFields_109028f2.zip

Loader.
Up arrow icon