Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Frank Brown
Flash Delivery
$546.00
908 Brown St.
906-5895
10/5/2020
10/8/2020
Cairo
SP
62971-462
1
Brad Wong
Logitrax
$3,435.00
4869 White St.
696-2535
10/30/2020
11/3/2020
Florence
RT
42254-757
2
Paul Richards
Flash Delivery
$1,380.00
5895 Bannon St.
358-5302
7/6/2020
7/8/2020
Florence
CS
74208-747
3
Tom White
Flash Delivery
$701.00
5156 Peters St.
821-8464
3/2/2024
3/6/2024
Sidney
RS
46915-250
4
Sue White
Flash Delivery
$3,463.00
3090 Bannon St.
376-3068
3/7/2024
3/10/2024
Rome
RT
68901-617
5
John Bannon
Logitrax
$3,392.00
3051 Richards St.
749-2016
2/14/2024
2/18/2024
Sidney
RT
60554-222
6
Joe Peters
Flash Delivery
$3,194.00
4614 Peters St.
886-2079
11/22/2024
11/23/2024
Rome
SP
30282-213
7
Bill Bannon
Flash Delivery
$2,248.00
6119 Brown St.
807-2122
12/15/2024
12/18/2024
York
RS
29527-145
8
Sue Richards
Speedy Express
$4,489.00
739 Wong St.
741-7954
2/23/2020
2/27/2020
Florence
SP
73950-884
9
Aaron Wong
Flash Delivery
$486.00
1690 Richards St.
129-6004
7/9/2025
7/10/2025
Rome
RN
92085-623
10
Tom Wong
Logitrax
$4,442.00
5797 Smith St.
245-2845
2/7/2020
2/11/2020
Sidney
RS
99986-417
11
Paul White
Flash Delivery
$434.00
3305 Richards St.
293-6774
5/17/2017
5/21/2017
York
RN
48421-973
12
Bill White
Flash Delivery
$3,798.00
9400 White St.
686-6581
2/24/2020
2/25/2020
Florence
RT
89762-883
13
Joe Wong
Flash Delivery
$1,575.00
7407 Smith St.
283-1072
9/18/2021
9/22/2021
Florence
RS
58793-246
14
Tony Adams
Logitrax
$1,509.00
8935 Brown St.
151-3895
10/27/2020
10/29/2020
York
RN
30430-909
15
Sue White
Flash Delivery
$1,548.00
3090 Bannon St.
376-3068
10/22/2022
10/25/2022
Rome
RT
68901-617
16
Sue Richards
Speedy Express
$1,724.00
739 Wong St.
741-7954
6/22/2017
6/26/2017
Florence
SP
73950-884
17
Paul Smith
Flash Delivery
$3,947.00
7042 Smith St.
874-3730
8/17/2023
8/19/2023
Rome
SP
40382-674
18
Tom Richards
Logitrax
$4,533.00
2931 Adams St.
646-3771
3/17/2024
3/20/2024
Paris
SP
83899-849
19
Sue Johnson
Flash Delivery
$3,974.00
2222 Smith St.
844-1808
1/13/2022
1/14/2022
Sidney
SP
56847-341
20
Joe Peters
Logitrax
$162.00
4614 Peters St.
886-2079
11/26/2023
11/30/2023
Rome
SP
30282-213
21
Tom Wong
Flash Delivery
$1,715.00
5797 Smith St.
245-2845
1/27/2024
1/30/2024
Sidney
RS
99986-417
22
Tom White
Flash Delivery
$330.00
5156 Peters St.
821-8464
1/24/2023
1/27/2023
Sidney
RS
46915-250
23
Joe Peters
Flash Delivery
$1,819.00
4614 Peters St.
886-2079
10/21/2018
10/25/2018
Rome
SP
30282-213
24
Tony Peters
Speedy Express
$528.00
3203 Richards St.
763-8370
11/12/2023
11/13/2023
Rome
CS
54122-363

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