Value Sorting in EJ 1 ASP.NET MVC PivotGrid

24 May 2019 / 1 minute to read


This feature is applicable for Relational datasource.

Value Sorting allows to sort columns and rows based on value fields.

The headers of the column to be sorted is given in the ‘HeaderText’ property under ‘ValueSortSettings’ in field wise order separated by a string. The string which is used to separate the headers is given in the property ‘HeaderDelimiters’.
Also you can sort column by clicking the column header. On clicking the same header once again will reverse the sorting direction.

  • js
  • @Html.EJ().Pivot().PivotGrid("PivotGrid1").DataSource(dataSource => dataSource.Rows(rows => { rows.FieldName("Country").FieldCaption("Country").Add(); }).Columns(columns => { columns.FieldName("Product").FieldCaption("Product").Add(); }).Values(values => { values.FieldName("Amount").Add(); values.FieldName("Quantity").Add(); })).ValueSortSettings(valuesortsettings=>valuesortsettings.HeaderText("Bike##Quantity").HeaderDelimiters("##").SortOrder(SortOrder.Descending))

    ASP NET MVC pivot grid control before applying value sorting

    ASP NET MVC pivt grid control after applying value sorting