Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Chris Johnson
Logitrax
$4,292.00
986 Smith St.
860-9158
5/13/2024
5/16/2024
Florence
SC
11852-653
1
Aaron Bannon
Logitrax
$1,664.00
6705 Brown St.
786-8950
3/9/2022
3/13/2022
York
SC
80837-609
2
Chris Brown
Speedy Express
$3,957.00
7907 Wong St.
613-2790
8/29/2020
9/2/2020
Hamburg
SC
37816-942
3
Aaron Wong
Speedy Express
$4,320.00
8489 Adams St.
166-1083
1/21/2018
1/22/2018
Florence
SC
60246-230
4
Chris Brown
Speedy Express
$3,669.00
7907 Wong St.
613-2790
10/16/2019
10/17/2019
Hamburg
SC
37816-942
5
Bill Johnson
Speedy Express
$2,968.00
2917 Wong St.
920-8147
1/10/2018
1/11/2018
Paris
RT
89325-491
6
Brad Peters
Speedy Express
$4,518.00
3780 Brown St.
541-1927
9/24/2018
9/25/2018
Sidney
CS
65287-168
7
Chris Johnson
Logitrax
$1,144.00
986 Smith St.
860-9158
2/7/2023
2/11/2023
Florence
SC
11852-653
8
Bill Smith
Speedy Express
$3,724.00
579 White St.
777-4113
6/11/2022
6/15/2022
Cairo
RT
65901-877
9
Frank Wong
Flash Delivery
$3,694.00
7074 Wong St.
680-1035
5/14/2023
5/17/2023
Sidney
CS
33167-234
10
Tony Johnson
Logitrax
$2,583.00
5949 Adams St.
125-5735
6/20/2024
6/23/2024
Paris
SC
60150-298
11
Frank Bannon
Flash Delivery
$3,456.00
4300 Adams St.
401-1043
9/8/2023
9/10/2023
Florence
SC
57505-265
12
Aaron Bannon
Flash Delivery
$4,625.00
6705 Brown St.
786-8950
6/5/2024
6/6/2024
York
SC
80837-609
13
Chris Johnson
Speedy Express
$3,288.00
986 Smith St.
860-9158
2/4/2021
2/7/2021
Florence
SC
11852-653
14
Mark Adams
Logitrax
$4,350.00
8643 Richards St.
155-5653
11/10/2023
11/11/2023
Cairo
SP
37120-333
15
Tony Smith
Logitrax
$2,609.00
9197 Johnson St.
763-6884
5/11/2021
5/13/2021
Florence
CS
82651-863
16
Tony Smith
Flash Delivery
$766.00
3797 White St.
786-5058
8/3/2023
8/7/2023
York
RT
61919-719
17
Tony Smith
Speedy Express
$3,412.00
3797 White St.
786-5058
8/31/2021
9/4/2021
York
RT
61919-719
18
John White
Flash Delivery
$2,505.00
1369 Brown St.
674-2760
2/12/2022
2/16/2022
Rome
CS
66093-329
19
Frank Wong
Logitrax
$4,790.00
7074 Wong St.
680-1035
4/20/2022
4/24/2022
Sidney
CS
33167-234
20
Tony Brown
Logitrax
$4,804.00
3679 Peters St.
168-6537
4/21/2019
4/22/2019
Hamburg
SP
95008-108
21
Aaron Richards
Flash Delivery
$653.00
8886 Brown St.
553-8552
3/20/2021
3/21/2021
Sidney
SC
74514-975
22
Tony Smith
Speedy Express
$3,750.00
3797 White St.
786-5058
7/31/2022
8/1/2022
York
RT
61919-719
23
Chris Johnson
Logitrax
$1,641.00
986 Smith St.
860-9158
10/8/2022
10/9/2022
Florence
SC
11852-653
24
Aaron Wong
Speedy Express
$295.00
8489 Adams St.
166-1083
6/14/2023
6/17/2023
Florence
SC
60246-230

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{
    @await Html.PartialAsync("_OptionsMenu", optionsModel)
}
  
@section Summary{
    @Html.Raw(MultiRowRes.Filter_Text0)
}