Features
- Overview
- Collapsible Column Headers
- Styling Records, Groups, and Cells
- Grouping
- Filtering
- Row and Column Freezing
- Paging
- Group Panel
- Remote Data Binding
- Custom Cells
- Custom Editors
- Editing
- Batch Editing
- Sorting
- Virtual Scrolling
- Disable Server Reading
- Data Map
- Excel Export
- PDF Export
- Unobtrusive Validation
Sorting
Sorting
This sample demonstrates how to use sort feature in the MultiRow control.
Features
ID
Start
Country
Color
Amount
Amount2
1
1/25/2025
German
581.61
-2,939.67
1/25/2025
Gadget
Green
0.14
2
2/25/2025
Canada
4,919.02
-4,673.75
2/25/2025
Gadget
Green
0.17
3
3/25/2025
Japan
2,159.73
-3,810.42
3/25/2025
Gadget
Red
0.07
4
4/25/2025
German
1,248.66
-2,815.93
4/25/2025
Gadget
Red
0.22
5
5/25/2025
German
4,051.76
-3,108.76
5/25/2025
Gadget
Black
0.12
6
6/25/2025
Canada
-3,131.28
-4,314.81
6/25/2025
Gadget
Black
0.16
7
7/25/2025
China
698.62
-2,745.97
7/25/2025
Widget
Red
0.15
8
8/25/2025
US
3,464.15
1,131.58
8/25/2025
Widget
White
0.03
9
9/25/2025
Korea
-2,363.16
3,425.60
9/25/2025
Gadget
Black
0.14
10
10/25/2025
US
-2,836.94
-4,283.10
10/25/2025
Widget
White
0.06
11
11/25/2025
France
877.93
2,722.02
11/25/2025
Widget
Green
0.08
12
12/25/2025
Korea
-3,788.14
-3,050.89
12/25/2025
Widget
Red
0.12
13
1/25/2025
German
-2,446.92
-2,351.67
1/25/2025
Gadget
Red
0.12
14
2/25/2025
German
-4,374.97
-3,899.38
2/25/2025
Widget
Black
0.18
15
3/25/2025
Japan
1,089.32
-4,102.95
3/25/2025
Gadget
Green
0.16
16
4/25/2025
China
1,341.85
532.34
4/25/2025
Gadget
Black
0.08
17
5/25/2025
US
3,596.33
623.80
5/25/2025
Widget
Black
0.18
18
6/25/2025
China
3,232.11
305.20
6/25/2025
Widget
Green
0.24
19
7/25/2025
France
-2,008.99
1,805.09
7/25/2025
Gadget
Green
0.09
20
8/25/2025
France
2,568.01
2,889.37
8/25/2025
Gadget
White
0.03
21
9/25/2025
UK
-3,476.95
4,852.50
9/25/2025
Widget
Black
0.01
22
10/25/2025
UK
2,290.56
3,295.03
10/25/2025
Widget
Red
0.06
23
11/25/2025
Japan
-4,146.76
853.06
11/25/2025
Gadget
White
0.01
24
12/25/2025
Canada
4,917.55
-4,479.39
12/25/2025
Gadget
Red
0.14
25
1/25/2025
Korea
3,824.28
2,007.51
1/25/2025
Gadget
Black
0.08
26
2/25/2025
Japan
-4,257.83
-1,652.26
2/25/2025
Gadget
White
0.23
27
3/25/2025
Italy
1,095.08
1,413.34
3/25/2025
Gadget
Black
0.20
28
4/25/2025
German
1,853.66
4,924.12
4/25/2025
Gadget
Green
0.18
29
5/25/2025
Italy
3,708.86
-2,697.08
5/25/2025
Widget
White
0.03
30
6/25/2025
Canada
-3,447.73
3,738.87
6/25/2025
Gadget
Green
0.10
31
7/25/2025
German
-165.64
-4,919.21
7/25/2025
Gadget
White
0.04
32
8/25/2025
China
160.62
1,299.66
8/25/2025
Widget
White
0.08
33
9/25/2025
Korea
-2,575.30
-1,036.23
9/25/2025
Widget
Red
0.17
34
10/25/2025
Italy
3,288.12
-2,392.41
10/25/2025
Widget
Red
0.19
35
11/25/2025
Korea
-4,563.28
1,361.51
11/25/2025
Gadget
Red
0.02
36
12/25/2025
Canada
-4,839.71
-1,835.02
12/25/2025
Widget
White
0.19
37
1/25/2025
US
544.13
-4,548.24
1/25/2025
Gadget
Red
0.10
38
2/25/2025
Canada
538.45
1,848.22
2/25/2025
Widget
Red
0.04
39
3/25/2025
Japan
1,493.10
391.20
3/25/2025
Gadget
Red
0.19
40
4/25/2025
US
-2,838.54
4,241.04
4/25/2025
Widget
Black
0.14
41
5/25/2025
UK
-3,175.21
-2,650.41
5/25/2025
Gadget
Black
0.18
42
6/25/2025
France
22.88
-2,410.67
6/25/2025
Widget
Black
0.17
43
7/25/2025
Korea
-4,129.88
-3,660.62
7/25/2025
Widget
Black
0.17
44
8/25/2025
Korea
2,170.82
-3,562.14
8/25/2025
Gadget
Green
0.14
45
9/25/2025
Korea
-3,000.98
-238.75
9/25/2025
Gadget
Red
0.09
46
10/25/2025
US
3,374.49
-4,629.37
10/25/2025
Gadget
Red
0.23
47
11/25/2025
Canada
-2,103.52
-4,860.82
11/25/2025
Widget
Green
0.23
48
12/25/2025
German
-2,077.64
-4,678.39
12/25/2025
Widget
Red
0.06
49
1/25/2025
France
-748.11
1,463.78
1/25/2025
Gadget
Green
0.14
50
2/25/2025
German
678.23
95.72
2/25/2025
Widget
Red
0.03
ID
Start
Country
Amount
Amount2
Active
End
Product
Color
Discount
Settings
Sorting Field :Description
In this sample, you can sort the collection based on the corresponding field value chosen in the first list.
You can also specify the sorting order in the second list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | using C1.Web.Mvc.Fluent; using C1.Web.Mvc.Grid; using C1.Web.Mvc.MultiRow; using C1.Web.Mvc.MultiRow.Fluent; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MultiRowExplorer.Models { public class LayoutDefinitionsBuilders { public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> OneLine { get { return ld => { ld.Add().Colspan(15).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).CssClass( "id" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).CssClass( "amount" )) .Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )) .Add(cell => cell.Binding( "Customer.Zip" ).Name( "CustomerZip" ).Header( "Zip" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Phone" ).Name( "Customerphone" ).Header( "Customer Phone" )) .Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" )) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Phone" ).Name( "ShipperPhone" ).Header( "Shipper Phone" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> TwoLines { get { return ld => { ld.Add().Header( "Order" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).CssClass( "id" ).Width( "150" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" ).Width( "150" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).CssClass( "amount" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )); }); ld.Add().Header( "Customer" ).Colspan(3).Cells(cells => { cells.Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" ).Width( "200" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).Colspan(2).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ).ShowDropDown( true ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )); }); ld.Add().Header( "Shipper" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" ).Colspan(2)) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).Width( "200" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> ThreeLines { get { return ld => { ld.Add().Header( "Order" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).Colspan(2).CssClass( "id" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).Colspan(2).CssClass( "amount" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )); }); ld.Add().Header( "Customer" ).Colspan(3).Cells(cells => { cells.Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).Colspan(2).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" ).Colspan(2)) .Add(cell => cell.Binding( "Customer.Phone" ).Name( "CustomerPhone" ).Header( "Phone" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )) .Add(cell => cell.Binding( "Customer.Zip" ).Name( "CustomerZip" ).Header( "Zip" )); }); ld.Add().Header( "Shipper" ).Cells(cells => { cells.Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" ).Width( "*" )) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> Sales { get { return ld => { ld.Add().Cells(cells => { cells.Add(cell => cell.Binding( "ID" ).Header( "ID" )); cells.Add(cell => cell.Binding( "Active" ).Header( "Active" )); }); ld.Add().Cells(cells => { cells.Add(cell => cell.Binding( "Start" ).Header( "Start" )); cells.Add(cell => cell.Binding( "End" ).Header( "End" )); }); ld.Add().Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Country" ).Header( "Country" ).Colspan(2)); cells.Add(cell => cell.Binding( "Product" ).Header( "Product" )); cells.Add(cell => cell.Binding( "Color" ).Header( "Color" )); }); ld.Add().Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Amount" ).Header( "Amount" )); cells.Add(cell => cell.Binding( "Amount2" ).Header( "Amount2" )); cells.Add(cell => cell.Binding( "Discount" ).Header( "Discount" ).Colspan(2)); }); }; } } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | using MultiRowExplorer.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MultiRowExplorer.Controllers { public partial class MultiRowController : Controller { public ActionResult Sorting() { return View(Sale.GetData(50)); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | @model IEnumerable< Sale > @ { var fields = new [] { "ID" , "Start" , "End" , "Country" , "Product" , "Color" , "Amount" , "Amount2" , "Discount" , "Active" }; var orders = new [] { "Ascending" , "Descending" }; ViewBag.DemoSettings = true ; ViewBag.SettingsByMenu = false ; } @ (Html.C1().MultiRow< Sale >() .Id( "sortingMultiRow" ) .CssClass( "multirow" ) .IsReadOnly( true ) .Bind(Model) .OrderBy( "ID" ) .LayoutDefinition(LayoutDefinitionsBuilders.Sales) ) @section Scripts{ <script> var field = "ID" , order = "Ascending" ; function sortMultiRow(combo) { var multiRow, ascending, sd; if (combo.hostElement.id === "sortingfield" ) field = combo.selectedValue; if (combo.hostElement.id === "sortingorder" ) order = combo.selectedValue; if (!field || !order) { return ; } multiRow = wijmo.Control.getControl( "#sortingMultiRow" ); ascending = order === "Ascending" ; sd = multiRow.collectionView.sortDescriptions; sdNew = new wijmo.collections.SortDescription(field, ascending); // remove any old sort descriptors and add the new one sd.splice(0, sd.length, sdNew); } </script> } @section Settings { Sorting Field : @ (Html.C1().ComboBox().Id( "sortingfield" ).Bind(fields).SelectedIndex(0).IsEditable( false ).OnClientSelectedIndexChanged( "sortMultiRow" )) Sorting Order : @ (Html.C1().ComboBox().Id( "sortingorder" ).Bind(orders).SelectedIndex(0).IsEditable( false ).OnClientSelectedIndexChanged( "sortMultiRow" )) } @section Summary{ This sample demonstrates how to use sort feature in the MultiRow control. } @section Description{ In this sample, you can sort the collection based on the corresponding field value chosen in the first list. You can also specify the sorting order in the second list. } |