Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Mark Adams
Flash Delivery
$3,782.00
7318 Wong St.
725-6330
6/14/2022
6/15/2022
Paris
RN
76500-770
1
Joe White
Logitrax
$977.00
137 Smith St.
122-7823
2/3/2020
2/4/2020
Florence
SP
26631-481
2
Mark Richards
Speedy Express
$2,221.00
4482 Peters St.
703-9444
8/9/2020
8/13/2020
Hamburg
RS
55156-520
3
Mark Wong
Logitrax
$298.00
1747 Smith St.
939-5268
12/3/2017
12/4/2017
Florence
SC
18150-851
4
Mark Johnson
Speedy Express
$1,747.00
4356 Adams St.
312-8240
3/8/2022
3/12/2022
Paris
SP
30172-515
5
Tony Bannon
Speedy Express
$1,655.00
9153 Bannon St.
702-2711
5/4/2020
5/6/2020
Paris
SP
23756-326
6
Joe Bannon
Flash Delivery
$1,189.00
1069 Peters St.
160-5438
9/21/2021
9/23/2021
York
RT
19907-750
7
Chris Johnson
Logitrax
$4,013.00
3579 Peters St.
802-1713
3/9/2020
3/13/2020
Paris
CS
47439-901
8
Aaron Adams
Logitrax
$508.00
3357 White St.
409-2709
7/25/2021
7/27/2021
Cairo
SP
67103-196
9
Sue Adams
Flash Delivery
$3,889.00
7869 Peters St.
703-6166
9/25/2023
9/29/2023
York
SC
17543-645
10
Mark White
Logitrax
$3,849.00
2455 White St.
147-6282
8/10/2020
8/11/2020
Sidney
RT
84949-778
11
Tom Wong
Logitrax
$3,632.00
3850 Brown St.
455-8616
12/7/2020
12/11/2020
York
RS
33994-277
12
Joe White
Flash Delivery
$2,074.00
137 Smith St.
122-7823
10/7/2022
10/11/2022
Florence
SP
26631-481
13
Mark Richards
Flash Delivery
$1,617.00
2774 White St.
795-6570
9/2/2022
9/5/2022
Rome
RS
70900-506
14
Aaron Brown
Flash Delivery
$4,183.00
3667 Brown St.
502-8309
10/31/2024
11/2/2024
York
SC
99195-410
15
Tom Adams
Logitrax
$2,476.00
5343 Wong St.
474-2638
4/30/2025
5/3/2025
Hamburg
RN
49851-433
16
Aaron Johnson
Flash Delivery
$3,933.00
5860 Smith St.
385-5068
7/13/2019
7/16/2019
Rome
RN
78744-898
17
Bill White
Logitrax
$2,956.00
8910 Smith St.
365-4064
4/21/2022
4/23/2022
Hamburg
RN
45467-904
18
Tom Wong
Flash Delivery
$1,571.00
3850 Brown St.
455-8616
6/1/2019
6/2/2019
York
RS
33994-277
19
Frank Peters
Speedy Express
$3,555.00
1802 Richards St.
141-2900
10/9/2020
10/13/2020
Cairo
SP
60515-694
20
Sue White
Flash Delivery
$4,753.00
4835 Smith St.
716-3811
12/5/2019
12/8/2019
Paris
SC
39920-152
21
Paul Bannon
Logitrax
$545.00
4569 White St.
228-2538
11/2/2023
11/3/2023
Sidney
SP
94340-466
22
Paul Peters
Logitrax
$1,884.00
5308 Brown St.
503-3703
9/30/2018
10/2/2018
Florence
CS
35197-233
23
Chris Bannon
Speedy Express
$1,169.00
1362 Richards St.
396-8712
2/7/2019
2/8/2019
Sidney
SC
63101-740
24
Sue White
Logitrax
$4,909.00
4835 Smith St.
716-3811
6/12/2018
6/16/2018
Paris
SC
39920-152

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