Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Mark Adams
Speedy Express
$4,185.00
2823 Smith St.
558-2802
7/22/2023
7/24/2023
Rome
RS
91600-595
1
Aaron Peters
Flash Delivery
$1,132.00
5234 White St.
394-1091
10/11/2022
10/14/2022
Hamburg
RS
99786-486
2
Aaron Peters
Flash Delivery
$4,523.00
5234 White St.
394-1091
11/6/2017
11/10/2017
Hamburg
RS
99786-486
3
Bill Richards
Logitrax
$542.00
7138 Richards St.
435-5838
8/21/2023
8/24/2023
Hamburg
SP
10643-872
4
Bill Wong
Logitrax
$3,627.00
8942 Brown St.
169-4411
4/11/2025
4/15/2025
Sidney
RS
21375-892
5
Chris Peters
Speedy Express
$4,503.00
459 Richards St.
485-1790
7/13/2018
7/17/2018
Florence
RT
63579-418
6
Brad White
Speedy Express
$4,839.00
8794 Wong St.
823-3154
3/6/2018
3/8/2018
Sidney
CS
88521-372
7
John Johnson
Logitrax
$1,103.00
6833 Brown St.
210-2416
6/12/2023
6/16/2023
Hamburg
CS
49173-600
8
Bill Richards
Logitrax
$2,697.00
9901 White St.
423-7133
1/2/2025
1/6/2025
Florence
RN
66619-732
9
Bill Johnson
Flash Delivery
$1,984.00
6199 Smith St.
697-6534
4/11/2024
4/15/2024
Hamburg
RS
88922-996
10
Tom White
Flash Delivery
$1,212.00
6718 White St.
125-7721
12/12/2022
12/14/2022
Cairo
CS
48878-925
11
John Smith
Speedy Express
$3,221.00
2025 White St.
938-3244
5/26/2023
5/29/2023
Hamburg
RN
21000-840
12
Frank Peters
Logitrax
$423.00
4481 Brown St.
935-2631
7/1/2021
7/5/2021
York
RN
48856-151
13
Bill Adams
Speedy Express
$2,110.00
8096 Peters St.
513-1698
11/15/2021
11/19/2021
Paris
RN
87042-911
14
Tony Peters
Flash Delivery
$1,909.00
8268 White St.
543-7059
10/12/2021
10/14/2021
Paris
CS
23581-269
15
John Richards
Flash Delivery
$4,037.00
5366 White St.
104-1568
10/15/2024
10/17/2024
Hamburg
CS
44214-725
16
Tom White
Logitrax
$342.00
6718 White St.
125-7721
6/25/2017
6/27/2017
Cairo
CS
48878-925
17
Brad Peters
Logitrax
$2,158.00
4772 Bannon St.
102-4771
12/29/2020
12/31/2020
Paris
RT
36115-961
18
Brad Bannon
Speedy Express
$1,408.00
3359 Wong St.
768-1912
12/14/2020
12/15/2020
Florence
RT
14483-762
19
Mark Richards
Speedy Express
$4,836.00
4762 Smith St.
617-5317
4/5/2023
4/9/2023
Sidney
RS
49484-616
20
Tom White
Speedy Express
$3,739.00
6718 White St.
125-7721
9/28/2023
9/30/2023
Cairo
CS
48878-925
21
Bill Richards
Speedy Express
$1,212.00
9901 White St.
423-7133
9/4/2018
9/8/2018
Florence
RN
66619-732
22
Mark Peters
Speedy Express
$956.00
4525 Peters St.
820-4721
11/20/2018
11/24/2018
Hamburg
CS
49841-705
23
John Adams
Speedy Express
$2,675.00
6033 Richards St.
943-2310
4/13/2025
4/16/2025
Sidney
RS
65071-392
24
Brad Bannon
Logitrax
$1,627.00
9468 Bannon St.
706-7129
1/13/2024
1/16/2024
York
RS
63828-983

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)
}