The following example demonstrates how to sort data by a particular column.
In this example, values of the Product Name field are sorted by September 1994 column summary values. To do this, two sort conditions represented by PivotGridFieldSortCondition instances are created. One of them identifies the ‘1994’ field value, while another identifies the ‘September’ value. These sort conditions are added to the Product Name field’s PivotGridFieldSortBySummaryInfo.Conditions collection to specify the column by which Product Name values should be sorted. A data field that identifies the column is specified via the PivotGridFieldSortBySummaryInfo.Field property.
usingSystem;
usingSystem.Web.UI;
usingDevExpress.XtraPivotGrid;
namespaceASPxPivotGrid_SortBySummary {
publicpartialclass _Default : Page {
protectedvoidASPxPivotGrid1_Load(object sender, EventArgs e) {
// Specifies a data field whose summary values should be used to sort values// of the Product Name field.
fieldProductName.SortBySummaryInfo.Field = fieldUnitPrice;
// Specifies a column by which the Product Name field values should be sorted.
fieldProductName.SortBySummaryInfo.Conditions.Clear();
fieldProductName.SortBySummaryInfo.Conditions.Add(
new PivotGridFieldSortCondition(fieldOrderYear, "1994"));
fieldProductName.SortBySummaryInfo.Conditions.Add(
new PivotGridFieldSortCondition(fieldOrderMonth, "9"));
}
}
}
ImportsMicrosoft.VisualBasicImportsSystemImportsSystem.Web.UIImportsDevExpress.XtraPivotGridNamespace ASPxPivotGrid_SortBySummary
PartialPublicClass _Default
Inherits Page
ProtectedSub ASPxPivotGrid1_Load(ByVal sender AsObject, ByVal e As EventArgs)
' Specifies a data field whose summary values should be used to sort values' of the Product Name field.
fieldProductName.SortBySummaryInfo.Field = fieldUnitPrice
' Specifies a column by which the Product Name field values should be sorted.
fieldProductName.SortBySummaryInfo.Conditions.Clear()
fieldProductName.SortBySummaryInfo.Conditions.Add( _
New PivotGridFieldSortCondition(fieldOrderYear, "1994"))
fieldProductName.SortBySummaryInfo.Conditions.Add( _
New PivotGridFieldSortCondition(fieldOrderMonth, "9"))
EndSubEndClassEndNamespace
Was this page helpful?
Thanks for your feedback!
How can we improve this help topic?
Additional comments/thoughts:
If you have any questions, submit a ticket to our Support Center.