Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Mark Richards
Speedy Express
$2,207.00
7142 Adams St.
496-8203
3/27/2022
3/29/2022
Rome
SP
14205-507
1
Tom White
Speedy Express
$3,220.00
1050 Bannon St.
639-1492
7/24/2024
7/28/2024
Rome
RT
95457-676
2
Brad Smith
Logitrax
$1,107.00
3411 Peters St.
106-7447
12/1/2020
12/3/2020
Rome
CS
73901-281
3
Brad Smith
Flash Delivery
$4,987.00
3411 Peters St.
106-7447
4/10/2024
4/12/2024
Rome
CS
73901-281
4
Tom Brown
Flash Delivery
$2,951.00
2768 Bannon St.
450-7896
3/19/2018
3/21/2018
Cairo
SP
66168-692
5
Bill Smith
Speedy Express
$1,205.00
7012 Brown St.
476-1341
10/21/2017
10/23/2017
Paris
SP
62879-725
6
Sue Peters
Speedy Express
$2,475.00
5700 Smith St.
381-7305
11/23/2024
11/25/2024
Paris
SP
86390-815
7
Tony Smith
Logitrax
$704.00
9746 Bannon St.
439-2156
8/17/2021
8/18/2021
Florence
RN
61885-164
8
Joe White
Speedy Express
$2,184.00
2344 Adams St.
448-8608
6/23/2023
6/27/2023
York
SC
68224-426
9
John Wong
Flash Delivery
$1,879.00
9232 Bannon St.
463-1030
4/24/2022
4/28/2022
Florence
RN
29073-882
10
Brad Smith
Logitrax
$4,227.00
3411 Peters St.
106-7447
4/22/2019
4/24/2019
Rome
CS
73901-281
11
Aaron Richards
Speedy Express
$3,669.00
7473 White St.
379-3338
7/18/2017
7/22/2017
York
SC
97137-440
12
Mark Bannon
Speedy Express
$4,442.00
4353 Richards St.
632-4750
5/20/2020
5/23/2020
Rome
CS
36596-180
13
Aaron Brown
Flash Delivery
$726.00
4484 Adams St.
409-1850
11/20/2023
11/24/2023
Paris
RN
35031-254
14
Tom Johnson
Speedy Express
$343.00
6242 Peters St.
813-2143
5/17/2025
5/18/2025
Florence
SP
17249-552
15
Mark Bannon
Speedy Express
$1,408.00
4353 Richards St.
632-4750
11/25/2017
11/26/2017
Rome
CS
36596-180
16
Tom Bannon
Flash Delivery
$332.00
4848 Johnson St.
125-7653
11/3/2024
11/4/2024
Sidney
SP
87238-655
17
Bill Richards
Speedy Express
$333.00
561 White St.
321-2923
10/1/2019
10/4/2019
Paris
RS
23732-264
18
Chris Peters
Speedy Express
$4,425.00
1741 Richards St.
568-3972
10/9/2019
10/11/2019
Florence
SP
99828-121
19
Bill Brown
Logitrax
$4,312.00
8647 Adams St.
266-7058
8/5/2020
8/6/2020
Florence
SC
14242-582
20
Frank Bannon
Flash Delivery
$230.00
314 Johnson St.
527-4186
12/31/2020
1/3/2021
Florence
RN
96924-378
21
Tony Adams
Speedy Express
$1,119.00
3833 White St.
938-3913
10/5/2020
10/7/2020
Florence
RS
51203-990
22
John Wong
Speedy Express
$882.00
9232 Bannon St.
463-1030
8/1/2017
8/4/2017
Florence
RN
29073-882
23
Bill Richards
Flash Delivery
$2,731.00
561 White St.
321-2923
6/9/2021
6/12/2021
Paris
RS
23732-264
24
Bill Brown
Logitrax
$4,906.00
8647 Adams St.
266-7058
12/10/2019
12/14/2019
Florence
SC
14242-582

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