Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Aaron Brown
Flash Delivery
$2,749.00
7749 Wong St.
825-6761
8/13/2019
8/16/2019
Cairo
RN
99581-152
1
Bill Bannon
Speedy Express
$4,312.00
5020 Smith St.
102-7907
10/14/2017
10/16/2017
Sidney
CS
98861-104
2
Aaron Smith
Speedy Express
$1,026.00
1571 Bannon St.
483-3535
3/15/2025
3/16/2025
Hamburg
RS
51833-916
3
John Bannon
Speedy Express
$4,193.00
5457 Wong St.
293-1900
7/9/2019
7/13/2019
Florence
RS
14222-871
4
Chris Richards
Logitrax
$3,218.00
5414 Johnson St.
328-6536
5/31/2017
6/2/2017
York
SC
87102-664
5
Joe Adams
Flash Delivery
$1,219.00
8028 Richards St.
456-8898
7/5/2024
7/6/2024
Cairo
RN
72544-626
6
Tony White
Logitrax
$2,426.00
1983 Bannon St.
561-7642
10/26/2022
10/29/2022
Florence
RS
56528-139
7
Sue Johnson
Flash Delivery
$1,034.00
6133 Johnson St.
784-5469
8/19/2018
8/20/2018
Hamburg
SC
30192-479
8
Bill Brown
Speedy Express
$3,530.00
120 White St.
257-7328
4/8/2025
4/12/2025
Paris
RN
72885-438
9
John Bannon
Speedy Express
$1,268.00
5457 Wong St.
293-1900
11/28/2023
12/2/2023
Florence
RS
14222-871
10
John White
Speedy Express
$2,885.00
9907 Richards St.
455-7826
3/23/2024
3/26/2024
Rome
SC
17049-286
11
Tom Johnson
Speedy Express
$3,110.00
1988 Richards St.
968-3423
1/31/2022
2/4/2022
Cairo
RN
60572-874
12
Tom Peters
Logitrax
$579.00
314 Johnson St.
766-8500
4/10/2019
4/11/2019
Sidney
RS
25648-676
13
Brad Johnson
Flash Delivery
$4,214.00
1017 Wong St.
450-3932
2/18/2021
2/21/2021
Florence
SC
98260-874
14
Paul Wong
Speedy Express
$2,052.00
6849 Smith St.
512-8742
11/13/2019
11/16/2019
Hamburg
SC
90285-565
15
Bill Adams
Logitrax
$1,799.00
2242 Peters St.
866-9226
8/5/2024
8/8/2024
Florence
CS
99420-246
16
Joe Peters
Speedy Express
$3,647.00
1984 Smith St.
710-9038
7/1/2022
7/5/2022
Paris
SC
86172-480
17
Sue Smith
Flash Delivery
$1,782.00
7710 Johnson St.
784-2386
6/15/2019
6/19/2019
Rome
RN
69704-831
18
Joe Adams
Flash Delivery
$2,856.00
8033 Johnson St.
772-3748
11/7/2017
11/9/2017
Cairo
SP
25575-871
19
Tony Bannon
Logitrax
$1,544.00
6436 Bannon St.
340-6838
1/8/2018
1/12/2018
Hamburg
RN
32544-360
20
Brad Smith
Flash Delivery
$2,676.00
5784 Bannon St.
397-4303
10/17/2020
10/21/2020
Paris
RN
98630-989
21
Sue Peters
Speedy Express
$2,380.00
7833 Brown St.
604-3038
1/12/2021
1/13/2021
Rome
RN
76065-543
22
Chris Bannon
Logitrax
$4,476.00
7694 Adams St.
897-8662
10/23/2018
10/26/2018
Rome
SC
26069-420
23
Joe Adams
Speedy Express
$2,741.00
8033 Johnson St.
772-3748
10/18/2018
10/20/2018
Cairo
SP
25575-871
24
Bill Wong
Flash Delivery
$3,096.00
5350 Wong St.
167-3422
8/14/2020
8/16/2020
Paris
RS
30628-311

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