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
Filtering
Filtering
This sample shows how to use filtering in the MultiRow control.
Features
Id
ShippedDate
Customer.Name
Customer.Email
Customer.Phone
Shipper.Name
0
Bill Brown
Bill.Brown@gmail.com
Speedy Express
$584.00
1556 Richards St.
270-1806
speedy@gmail.com
4/11/2022
4/12/2022
Rome
SC
92149-411
1
Frank Brown
Frank.Brown@gmail.com
Flash Delivery
$2,217.00
6386 Richards St.
387-1046
flash@gmail.com
12/25/2024
12/27/2024
Cairo
CS
55459-538
2
Joe Smith
Joe.Smith@gmail.com
Logitrax
$2,443.00
4225 Brown St.
531-9079
logitrax@gmail.com
6/16/2021
6/19/2021
Florence
RN
43029-400
3
Tony Smith
Tony.Smith@gmail.com
Logitrax
$3,671.00
3050 Wong St.
323-9500
logitrax@gmail.com
2/3/2020
2/6/2020
Hamburg
RN
21855-768
4
Bill Bannon
Bill.Bannon@gmail.com
Flash Delivery
$1,594.00
6194 Johnson St.
662-4397
flash@gmail.com
7/31/2021
8/1/2021
Cairo
RN
73901-623
5
Brad White
Brad.White@gmail.com
Speedy Express
$457.00
4031 Smith St.
216-7641
speedy@gmail.com
7/21/2021
7/24/2021
Cairo
SP
46852-605
6
Paul Richards
Paul.Richards@gmail.com
Logitrax
$1,087.00
1482 White St.
940-1774
logitrax@gmail.com
10/3/2020
10/6/2020
Sidney
SP
37049-401
7
John Brown
John.Brown@gmail.com
Flash Delivery
$185.00
9551 Adams St.
401-4589
flash@gmail.com
1/30/2022
2/1/2022
York
RN
12948-300
8
Mark Adams
Mark.Adams@gmail.com
Logitrax
$2,182.00
6000 Brown St.
382-3145
logitrax@gmail.com
2/7/2022
2/11/2022
Hamburg
CS
40056-925
9
Joe Wong
Joe.Wong@gmail.com
Logitrax
$2,856.00
5403 Richards St.
920-2029
logitrax@gmail.com
11/19/2017
11/22/2017
Florence
RT
73156-772
10
John Adams
John.Adams@gmail.com
Speedy Express
$1,526.00
5913 Johnson St.
844-4376
speedy@gmail.com
11/26/2019
11/29/2019
Cairo
RT
49377-873
11
Paul Bannon
Paul.Bannon@gmail.com
Flash Delivery
$886.00
8138 Peters St.
943-9033
flash@gmail.com
11/11/2022
11/15/2022
Rome
RT
29456-636
12
Brad Peters
Brad.Peters@gmail.com
Logitrax
$3,559.00
4640 Bannon St.
598-1475
logitrax@gmail.com
12/9/2020
12/11/2020
Rome
SC
20433-976
13
Paul Bannon
Paul.Bannon@gmail.com
Flash Delivery
$4,385.00
8138 Peters St.
943-9033
flash@gmail.com
6/6/2018
6/8/2018
Rome
RT
29456-636
14
John Adams
John.Adams@gmail.com
Speedy Express
$3,543.00
8560 White St.
719-6238
speedy@gmail.com
2/12/2023
2/15/2023
Sidney
SP
97951-549
15
Aaron Johnson
Aaron.Johnson@gmail.com
Flash Delivery
$2,749.00
4208 Wong St.
299-3838
flash@gmail.com
9/21/2020
9/24/2020
York
RS
60877-814
16
Bill Bannon
Bill.Bannon@gmail.com
Flash Delivery
$4,786.00
6194 Johnson St.
662-4397
flash@gmail.com
10/18/2018
10/22/2018
Cairo
RN
73901-623
17
Paul Adams
Paul.Adams@gmail.com
Flash Delivery
$4,674.00
3954 Brown St.
800-7116
flash@gmail.com
12/4/2017
12/6/2017
Rome
RN
10935-232
18
Chris Johnson
Chris.Johnson@gmail.com
Speedy Express
$1,933.00
3874 Wong St.
247-1532
speedy@gmail.com
1/8/2021
1/9/2021
Rome
CS
96751-578
19
Paul Smith
Paul.Smith@gmail.com
Logitrax
$4,414.00
7611 Bannon St.
792-3588
logitrax@gmail.com
9/27/2024
9/28/2024
Sidney
RS
77184-399
20
Mark Adams
Mark.Adams@gmail.com
Flash Delivery
$4,578.00
6000 Brown St.
382-3145
flash@gmail.com
5/16/2020
5/20/2020
Hamburg
CS
40056-925
21
Paul White
Paul.White@gmail.com
Flash Delivery
$4,426.00
8136 White St.
262-9726
flash@gmail.com
7/21/2024
7/25/2024
Cairo
CS
28643-595
22
Tony Smith
Tony.Smith@gmail.com
Logitrax
$4,823.00
3050 Wong St.
323-9500
logitrax@gmail.com
12/20/2019
12/22/2019
Hamburg
RN
21855-768
23
Aaron Wong
Aaron.Wong@gmail.com
Logitrax
$3,879.00
5855 Brown St.
611-9514
logitrax@gmail.com
6/29/2020
7/1/2020
Hamburg
CS
94362-394
24
Aaron Johnson
Aaron.Johnson@gmail.com
Logitrax
$1,497.00
4208 Wong St.
299-3838
logitrax@gmail.com
3/24/2021
3/26/2021
York
RS
60877-814
ID
Customer
Customer Email
Shipper
Amount
Address
Phone
Shipper Email
Ordered
Shipped
City
State
Zip
Express
Settings
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 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 | using C1.Web.Mvc; using MultiRowExplorer.Models; using System; using System.Collections.Generic; using System.Web.Mvc; using System.Linq; namespace MultiRowExplorer.Controllers { public partial class MultiRowController : Controller { private static OptionItem CreateOptionItem() { return new OptionItem { Values = new List< string > { "None" , "Condition" , "Value" , "Both" }, CurrentValue = "Both" }; } private readonly ControlOptions _filterOptions = new ControlOptions { Options = new OptionDictionary { { "CustomerState" , CreateOptionItem()}, { "CustomerCity" , CreateOptionItem()}, { "ShipperName" , CreateOptionItem()}, { "ShipperExpress" , CreateOptionItem()}, { "Amount" , CreateOptionItem()} } }; public ActionResult Filter(FormCollection data) { _filterOptions.LoadPostData(data); ViewBag.DemoOptions = _filterOptions; ViewBag.FilterTypes = GetFilterTypes(_filterOptions); return View(Orders.GetOrders()); } private Dictionary< string , FilterType> GetFilterTypes(ControlOptions controlOptions) { var filterTypes = new Dictionary< string , FilterType>(); foreach (var item in controlOptions.Options) { filterTypes.Add(item.Key, (FilterType)Enum.Parse( typeof (FilterType), item.Value.CurrentValue)); } return filterTypes; } } } |
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 | @model IEnumerable< Orders.Order > @ { ControlOptions optionsModel = ViewBag.DemoOptions; Dictionary< string , FilterType> filterTypes = ViewBag.FilterTypes; ViewBag.DemoSettings = true ; ViewBag.DemoDescription = false ; } @section Styles{ < style > label { display: inline-block; font-weight: normal; padding: 3px; } </ style > } @ (Html.C1().MultiRow< Orders.Order >() .Id( "filteringMultiRow" ) .Bind(Model) .PageSize(25) .IsReadOnly( true ) .LayoutDefinition(LayoutDefinitionsBuilders.ThreeLines) .SelectionMode(SelectionMode.Row) .AllowSorting( true ) .Filterable(f => f.DefaultFilterType(FilterType.Both) .ColumnFilters(cfsb => { foreach (var item in filterTypes) { cfsb.Add(cfb => cfb.Column(item.Key).FilterType(item.Value)); } }) ) .CssClass( "multirow" ) ) @ (Html.C1().Pager().Owner( "filteringMultiRow" )) @section Settings{ @Html .Partial( "_OptionsMenu" , optionsModel) } @section Summary{ This sample shows how to use filtering in the MultiRow control. } |