Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Sue Richards
Flash Delivery
$1,278.00
3586 White St.
280-4220
6/14/2022
6/17/2022
Sidney
SC
37534-281
1
Bill Smith
Flash Delivery
$4,418.00
6617 Brown St.
342-2017
11/14/2024
11/16/2024
Hamburg
SP
44080-388
2
Aaron Smith
Flash Delivery
$3,801.00
8173 Johnson St.
249-7454
3/10/2024
3/14/2024
York
CS
32125-602
3
John Richards
Logitrax
$2,424.00
4472 White St.
466-1826
6/6/2021
6/9/2021
Hamburg
SP
91427-477
4
Frank Bannon
Logitrax
$2,604.00
2116 Adams St.
218-3155
12/26/2023
12/30/2023
Sidney
RT
73463-568
5
Paul Wong
Speedy Express
$2,088.00
5676 Richards St.
894-7146
12/1/2021
12/5/2021
Paris
RN
75737-263
6
Brad Brown
Logitrax
$1,550.00
8868 Johnson St.
452-5935
9/20/2021
9/21/2021
Rome
SP
61457-467
7
Tom Johnson
Flash Delivery
$1,847.00
1218 White St.
814-4851
11/19/2018
11/20/2018
Rome
RT
57018-570
8
John Brown
Speedy Express
$1,241.00
1162 Johnson St.
184-9877
2/8/2025
2/10/2025
Cairo
RS
61439-253
9
Brad Brown
Speedy Express
$514.00
8868 Johnson St.
452-5935
5/20/2020
5/22/2020
Rome
SP
61457-467
10
Mark Johnson
Flash Delivery
$869.00
2114 Smith St.
326-8233
12/29/2021
12/30/2021
Paris
RT
48027-301
11
Paul Smith
Speedy Express
$491.00
2069 White St.
252-9731
10/25/2021
10/26/2021
Florence
CS
46486-381
12
Bill Smith
Speedy Express
$3,348.00
6617 Brown St.
342-2017
12/22/2022
12/23/2022
Hamburg
SP
44080-388
13
John Smith
Logitrax
$739.00
4589 Smith St.
205-9302
4/4/2025
4/7/2025
Florence
CS
48398-759
14
John Peters
Logitrax
$1,267.00
5480 Bannon St.
389-2538
7/31/2021
8/1/2021
Paris
RS
19296-564
15
Tony Adams
Flash Delivery
$4,391.00
1779 Brown St.
566-5280
4/5/2019
4/8/2019
Cairo
RN
21171-739
16
Tony Richards
Flash Delivery
$3,891.00
2379 Brown St.
198-3475
9/26/2024
9/29/2024
Hamburg
SC
89609-125
17
Frank Bannon
Speedy Express
$1,319.00
2116 Adams St.
218-3155
10/7/2022
10/11/2022
Sidney
RT
73463-568
18
Brad Peters
Flash Delivery
$1,710.00
987 White St.
554-2619
10/6/2019
10/10/2019
Rome
RT
68039-625
19
Tony Adams
Speedy Express
$1,394.00
4179 Adams St.
103-5243
7/17/2017
7/21/2017
Hamburg
RS
56279-481
20
Brad Brown
Logitrax
$3,419.00
1659 White St.
896-4897
5/8/2025
5/9/2025
Florence
SC
17620-949
21
Tony Adams
Logitrax
$3,637.00
862 White St.
944-4615
11/2/2023
11/6/2023
Florence
SP
75750-320
22
Brad Richards
Logitrax
$754.00
5491 Johnson St.
474-1477
4/6/2019
4/7/2019
Hamburg
RN
97065-666
23
Tony Adams
Logitrax
$3,009.00
1401 Johnson St.
377-3252
5/18/2020
5/20/2020
Florence
RS
39755-943
24
John Richards
Speedy Express
$4,907.00
4472 White St.
466-1826
1/12/2025
1/14/2025
Hamburg
SP
91427-477

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