This is a migrated thread and some comments may be shown as answers.

Pivot Table Sample Bug

1 Answer 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amir
Top achievements
Rank 1
Amir asked on 06 Jul 2010, 08:30 AM
Hi Telerik,

I think we have found a minor bug in the Pivot Table Sample for RadGrid where the PivotTable() method skips the first column of the table when it converts a vertical table structure to a horizontal structure.

Here is the code:

Please redeem us some points if we are first to report this :).

Regards,

Amir

public DataTable PivotTable(DataTable source)
{
DataTable dest = new DataTable("Pivoted" + source.TableName);

dest.Columns.Add(" ");

foreach (DataRow r in source.Rows)
dest.Columns.Add(r[0].ToString());

for (int i = 0; i < source.Columns.Count - 1; i++)      // Columns count should not be decreased by one
{
dest.Rows.Add(dest.NewRow());
}

for (int r = 0; r < dest.Rows.Count; r++)
{
for (int c = 0; c < dest.Columns.Count; c++)
{
if (c == 0)
dest.Rows[r][0] = source.Columns[r + 1].ColumnName; // Row index should not be increased by one
else
dest.Rows[r][c] = source.Rows[c - 1][r + 1]; // Row index should not be increased by one
}
}
dest.AcceptChanges();
return dest;
        }

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 09 Jul 2010, 02:28 PM
Hello Amir,

I review the mentioned demo and I can confirm data is displayed properly there. Can you specify what how data is displayed in regular and pivot grid in your case so we can check it further?

All the best,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Amir
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or