Example of Value Sorting in ASP.NET MVC Pivot Table Control
This sample demonstrates ordering of values in ascending or descending order. Here, the FY 2015 -> In Stock column header text is ordered by defining sort-related settings in code behind.
FY 2015 | FY 2016 | FY 2017 | FY 2018 | Grand Total | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
In Stock | Units Sold | Sold Amount | In Stock | Units Sold | Sold Amount | In Stock | Units Sold | Sold Amount | In Stock | Units Sold | Sold Amount | In Stock | Units Sold | Sold Amount | |
Germany | 5614 | 44154 | $16,903,257.27 | 5523 | 47910 | $18,081,139.06 | 5462 | 47214 | $18,479,733.38 | 1347 | 11419 | $5,042,868.49 | 17946 | 150697 | $58,506,998.2 |
United States | 5171 | 47724 | $16,224,668.54 | 5442 | 47691 | $17,915,993.08 | 4823 | 46602 | $20,120,714.29 | 1199 | 11715 | $4,352,331.85 | 16635 | 153732 | $58,613,707.76 |
France | 5066 | 46939 | $19,097,073.84 | 5248 | 44513 | $19,575,092.52 | 5581 | 48207 | $18,251,898.21 | 1152 | 11516 | $5,553,761.57 | 17047 | 151175 | $62,477,826.14 |
United Kingdom | 2864 | 25457 | $18,197,943.25 | 2991 | 23944 | $15,422,056.5 | 2924 | 25836 | $17,740,233 | 811 | 6375 | $5,236,607.5 | 9590 | 81612 | $56,596,840.25 |
Grand Total | 18715 | 164274 | $70,422,942.9 | 19204 | 164058 | $70,994,281.16 | 18790 | 167859 | $74,592,578.88 | 4509 | 41025 | $20,185,569.41 | 61218 | 537216 | $236,195,372.4 |
- Quarter
- Year
- Order Source
- Products
- Product Categories
- Country
- Sold Amount
- Units Sold
- In Stock
You can sort column values by clicking the column header. Clicking the same header once again will reverse the sorting
direction. It can be enabled by setting the enableValueSorting
as true.
Value sort-related settings can be defined in code behind, too. To do so, headers of the column to be sorted are given
in the
headerText
property under
valueSortSettings
, separated by a delimiter string. The purpose of providing complete header text here is to indicate exactly which
value column needs to be sorted. The string which is used to separate the headers is given in the property
headerDelimiters
. The sorting direction is performed by the
sortOrder
property.