Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Aaron Wong
Logitrax
$1,030.00
5617 Wong St.
260-7639
1/13/2019
1/17/2019
York
RN
45682-404
1
Tony Wong
Logitrax
$3,052.00
5894 Smith St.
945-7107
11/3/2024
11/6/2024
Sidney
RT
17579-981
2
Mark Adams
Flash Delivery
$2,623.00
4864 White St.
327-7481
8/23/2017
8/24/2017
Florence
SC
51146-536
3
Paul White
Speedy Express
$3,021.00
7021 Bannon St.
781-7018
8/30/2022
9/3/2022
Hamburg
RN
57809-935
4
Brad Johnson
Flash Delivery
$1,445.00
4656 Peters St.
679-5363
2/2/2021
2/6/2021
Cairo
SC
12371-230
5
Frank Smith
Speedy Express
$1,219.00
687 Brown St.
481-4490
4/11/2022
4/13/2022
Cairo
CS
41216-644
6
Chris Brown
Logitrax
$845.00
3708 Wong St.
448-3081
2/17/2025
2/20/2025
Paris
CS
62933-913
7
Joe Bannon
Speedy Express
$900.00
6292 Brown St.
462-1625
3/31/2020
4/3/2020
Sidney
SC
96823-788
8
Aaron Wong
Logitrax
$2,536.00
5617 Wong St.
260-7639
3/14/2024
3/15/2024
York
RN
45682-404
9
Tom Adams
Speedy Express
$144.00
1545 Johnson St.
354-2956
8/29/2023
9/2/2023
Florence
SC
77617-359
10
Chris Wong
Flash Delivery
$1,179.00
8587 Peters St.
633-1189
12/4/2020
12/5/2020
Florence
SC
52169-762
11
Joe Johnson
Flash Delivery
$1,903.00
2883 Brown St.
306-6744
12/25/2018
12/28/2018
Rome
SP
24442-707
12
Sue Smith
Logitrax
$4,023.00
4670 Adams St.
350-1690
7/11/2020
7/13/2020
Florence
RS
75819-974
13
Chris Johnson
Logitrax
$1,839.00
5905 White St.
758-9293
8/31/2022
9/1/2022
Paris
RT
91674-785
14
Aaron Wong
Logitrax
$2,843.00
5617 Wong St.
260-7639
5/26/2019
5/29/2019
York
RN
45682-404
15
Sue Bannon
Speedy Express
$4,721.00
3400 Wong St.
831-5704
7/17/2021
7/19/2021
Cairo
SP
78928-399
16
Tom White
Flash Delivery
$4,328.00
7350 Adams St.
698-6302
8/30/2020
9/1/2020
Sidney
RS
52792-231
17
Mark Richards
Speedy Express
$1,473.00
4895 Adams St.
213-2797
6/6/2017
6/8/2017
York
CS
86484-144
18
Tom Johnson
Flash Delivery
$1,322.00
9707 Bannon St.
686-9690
7/24/2024
7/25/2024
Hamburg
CS
89090-977
19
Sue Smith
Flash Delivery
$4,425.00
4670 Adams St.
350-1690
11/27/2019
11/29/2019
Florence
RS
75819-974
20
Paul Johnson
Speedy Express
$3,041.00
5828 Wong St.
726-4809
4/2/2024
4/4/2024
Sidney
CS
57700-335
21
Joe White
Speedy Express
$4,426.00
3028 Bannon St.
714-5916
10/12/2017
10/15/2017
Cairo
SP
17432-160
22
Paul Peters
Logitrax
$1,306.00
2398 Bannon St.
155-5366
1/22/2023
1/25/2023
Rome
CS
82141-869
23
Joe White
Logitrax
$415.00
3028 Bannon St.
714-5916
5/7/2024
5/10/2024
Cairo
SP
17432-160
24
Tom Adams
Flash Delivery
$3,982.00
1545 Johnson St.
354-2956
8/25/2017
8/29/2017
Florence
SC
77617-359

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