Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Bill White
Speedy Express
$2,137.00
5901 Richards St.
294-9396
3/5/2025
3/9/2025
Paris
SP
24352-407
1
Paul White
Flash Delivery
$1,913.00
8156 Wong St.
313-7892
7/24/2021
7/26/2021
Hamburg
CS
61200-746
2
Chris Brown
Logitrax
$4,789.00
2687 Peters St.
340-7565
11/8/2020
11/10/2020
Sidney
SC
72855-900
3
Joe Peters
Speedy Express
$3,393.00
7108 Adams St.
926-3157
6/19/2025
6/20/2025
York
SC
20721-455
4
Chris Adams
Logitrax
$3,713.00
1545 Adams St.
993-9338
4/18/2024
4/22/2024
Cairo
SP
42383-899
5
John Peters
Logitrax
$3,947.00
7773 Brown St.
973-9241
9/10/2024
9/13/2024
Sidney
SP
46290-690
6
Brad Smith
Flash Delivery
$1,310.00
7498 Johnson St.
210-7509
8/5/2024
8/9/2024
Florence
CS
41544-295
7
Sue Bannon
Speedy Express
$1,468.00
3900 White St.
487-9169
3/29/2020
4/2/2020
Cairo
SP
28232-334
8
Bill Brown
Logitrax
$1,620.00
4736 Bannon St.
418-3202
11/21/2020
11/25/2020
Florence
RT
37869-228
9
John Adams
Logitrax
$1,723.00
2129 Wong St.
817-5739
6/2/2025
6/4/2025
Hamburg
RN
30322-679
10
Tony Brown
Speedy Express
$2,028.00
8733 Wong St.
347-2231
3/24/2025
3/26/2025
Florence
CS
38117-467
11
Tony Smith
Logitrax
$2,031.00
9185 Wong St.
262-1253
10/29/2024
10/30/2024
Cairo
CS
58127-772
12
Paul White
Flash Delivery
$4,207.00
8156 Wong St.
313-7892
6/26/2019
6/28/2019
Hamburg
CS
61200-746
13
John Smith
Speedy Express
$4,538.00
9063 Smith St.
919-7144
3/29/2019
3/30/2019
Paris
RS
31161-755
14
Bill White
Logitrax
$670.00
2002 Richards St.
579-5633
2/13/2025
2/17/2025
Paris
RS
41730-869
15
Paul Wong
Logitrax
$1,961.00
1921 Richards St.
619-8980
4/2/2022
4/5/2022
Cairo
RT
22838-267
16
Brad White
Logitrax
$1,380.00
6658 Bannon St.
260-8362
7/26/2020
7/28/2020
Florence
RS
87828-218
17
Paul Bannon
Flash Delivery
$4,548.00
8295 Adams St.
611-9637
11/1/2019
11/3/2019
Paris
RT
72712-669
18
Tom Adams
Flash Delivery
$1,096.00
7826 Wong St.
238-9836
7/2/2021
7/5/2021
Florence
CS
46206-558
19
Bill White
Speedy Express
$4,657.00
5901 Richards St.
294-9396
12/25/2024
12/29/2024
Paris
SP
24352-407
20
Aaron Richards
Logitrax
$596.00
1785 Smith St.
434-1626
3/20/2019
3/23/2019
Hamburg
RS
82444-487
21
Paul Adams
Logitrax
$2,155.00
2216 Adams St.
713-2621
7/22/2024
7/24/2024
Paris
RT
62442-109
22
Aaron Richards
Flash Delivery
$818.00
1785 Smith St.
434-1626
11/29/2021
12/3/2021
Hamburg
RS
82444-487
23
Chris Bannon
Logitrax
$385.00
1632 Richards St.
394-3948
11/25/2022
11/26/2022
Cairo
SP
56090-451
24
Aaron Adams
Logitrax
$998.00
4754 Peters St.
502-8454
8/9/2022
8/11/2022
Paris
SC
11707-117

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
using C1.Web.Mvc;
using MultiRowExplorer.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using C1.Web.Mvc.Serialization;
using Microsoft.AspNetCore.Http;
  
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(IFormCollection data)
        {
            _filterOptions.LoadPostData(data);
            ViewBag.DemoOptions = _filterOptions;
            ViewBag.FilterTypes = GetFilterTypes(_filterOptions);
            return View();
        }
  
        public ActionResult Filter_Bind([C1JsonRequest] CollectionViewRequest<Orders.Order> requestData)
        {
            return this.C1Json(CollectionViewHelper.Read(requestData, 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
48
49
50
51
52
53
54
@model IEnumerable<Orders.Order>
@{
    var cities = Orders.GetCities().ToValues();
    ControlOptions optionsModel = ViewBag.DemoOptions;
    Dictionary<string, FilterType> filterTypes = ViewBag.FilterTypes;
    ViewBag.DemoSettings = true;
    ViewBag.DemoDescription = false;
}
  
<c1-multi-row id="filteringMultiRow" is-read-only="true" selection-mode="Row"
              sorting-type="SingleColumn" class="multirow">
    <c1-items-source read-action-url="@Url.Action("Filter_Bind")" page-size="25"></c1-items-source>
    <c1-multi-row-cell-group header="Order" colspan="2">
        <c1-multi-row-cell binding="Id" header="ID" class="id" colspan="2" />
        <c1-multi-row-cell binding="Amount" header="Amount" format="c" class="amount" colspan="2" />
        <c1-multi-row-cell binding="Date" header="Ordered" />
        <c1-multi-row-cell binding="ShippedDate" header="Shipped" />
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group header="Customer" colspan="3">
        <c1-multi-row-cell binding="Customer.Name" name="CustomerName" header="Customer" />
        <c1-multi-row-cell binding="Customer.Email" name="CustomerEmail" header="Customer Email" class="email" colspan="2" />
        <c1-multi-row-cell binding="Customer.Address" name="CustomerAddress" header="Address" colspan="2" />
        <c1-multi-row-cell binding="Customer.Phone" name="CustomerPhone" header="Customer Phone" />
        <c1-multi-row-cell binding="Customer.City" name="CustomerCity" header="City" datamap-editor="@C1.Web.Mvc.Grid.DataMapEditor.DropDownList">
            <c1-data-map display-member-path="Value" selected-value-path="Value">
                <c1-items-source source-collection="cities" />
            </c1-data-map>
        </c1-multi-row-cell>
        <c1-multi-row-cell binding="Customer.State" name="CustomerState" header="State" />
        <c1-multi-row-cell binding="Customer.Zip" name="CustomerZip" header="Zip" />
    </c1-multi-row-cell-group>
    <c1-multi-row-cell-group header="Shipper">
        <c1-multi-row-cell binding="Shipper.Name" name="ShipperName" header="Shipper" width="*" />
        <c1-multi-row-cell binding="Shipper.Email" name="ShipperEmail" header="Shipper Email" class="email" />
        <c1-multi-row-cell binding="Shipper.Express" name="ShipperExpress" header="Express" />
    </c1-multi-row-cell-group>
    <c1-flex-grid-filter default-filter-type="Both">
        <c1-flex-grid-column-filter column="CustomerState" filter-type="@filterTypes["CustomerState"]"></c1-flex-grid-column-filter>
        <c1-flex-grid-column-filter column="CustomerCity" filter-type="@filterTypes["CustomerCity"]"></c1-flex-grid-column-filter>
        <c1-flex-grid-column-filter column="ShipperName" filter-type="@filterTypes["ShipperName"]"></c1-flex-grid-column-filter>
        <c1-flex-grid-column-filter column="ShipperExpress" filter-type="@filterTypes["ShipperExpress"]"></c1-flex-grid-column-filter>
        <c1-flex-grid-column-filter column="Amount" filter-type="@filterTypes["Amount"]"></c1-flex-grid-column-filter>
    </c1-flex-grid-filter>
</c1-multi-row>
  
<c1-pager owner="filteringMultiRow"></c1-pager>
  
@section Settings{
    @Html.Partial("_OptionsMenu", optionsModel)
}
  
@section Summary{
    @Html.Raw(MultiRowRes.Filter_Text0)
}