After a user configures their Pivotgrid to show the data the way they like it, I would like to get the resulting data into a data table for other uses like generating a chart off of the the resulting data. It would be like the excel export function but export to a datatable in code behind.
1 Answer, 1 is accepted
0
Attila Antal
Telerik team
answered on 25 Aug 2020, 03:25 PM
Hi David,
That is an interesting scenario. We haven't done this before, but it may be implemented. You can try to loop through the items, fields and build a structure of data table of your choice.
Here are a few examples of the server-side API to loop through different items
protectedvoidRadButton1_Click(object sender, EventArgs e)
{
foreach (var colField in RadPivotGrid1.Fields.OfType<PivotGridColumnField>())
{
var colFieldName = colField.UniqueName;
}
foreach (var rowField in RadPivotGrid1.Fields.OfType<PivotGridRowField>())
{
var rowFieldName = rowField.UniqueName;
}
foreach (var rowHeaderItem in RadPivotGrid1.Items.OfType<PivotGridRowHeaderItem>())
{
foreach (PivotGridHeaderCell headerCell in rowHeaderItem.Cells)
{
var headerCellText = headerCell.Text;
}
}
foreach (var rowItem in RadPivotGrid1.Items.OfType<PivotGridRowItem>())
{
foreach (PivotGridDataCell dataCell in rowItem.Cells)
{
var dataCellText = dataCell.Text;
}
}
}
Regards,
Attila Antal
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).