Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Chris Wong
Speedy Express
$3,859.00
9752 White St.
419-6567
3/15/2025
3/16/2025
Hamburg
CS
47454-255
1
Mark Wong
Speedy Express
$353.00
1946 Brown St.
994-2154
7/19/2021
7/22/2021
Cairo
RN
94092-220
2
Tom Peters
Logitrax
$4,324.00
2348 White St.
261-6701
10/26/2024
10/28/2024
Sidney
CS
35562-892
3
Chris Peters
Speedy Express
$3,815.00
1195 White St.
132-9819
6/2/2020
6/3/2020
York
RT
44403-863
4
Tom Adams
Speedy Express
$4,492.00
6884 Adams St.
517-4373
5/19/2017
5/21/2017
York
RT
26432-811
5
Aaron Richards
Speedy Express
$1,638.00
8275 Brown St.
452-9032
9/4/2024
9/8/2024
Cairo
RN
43231-916
6
Tom Peters
Logitrax
$2,796.00
2348 White St.
261-6701
6/30/2018
7/3/2018
Sidney
CS
35562-892
7
Mark Wong
Logitrax
$3,680.00
1946 Brown St.
994-2154
7/13/2025
7/17/2025
Cairo
RN
94092-220
8
Aaron Richards
Logitrax
$389.00
8275 Brown St.
452-9032
5/24/2021
5/25/2021
Cairo
RN
43231-916
9
Bill Bannon
Logitrax
$2,552.00
9915 White St.
807-8760
3/4/2023
3/7/2023
Florence
SC
16161-360
10
Aaron Brown
Flash Delivery
$3,715.00
7922 Brown St.
290-3116
4/7/2023
4/11/2023
Hamburg
SP
93593-280
11
Bill Adams
Speedy Express
$2,566.00
277 Richards St.
834-7583
3/24/2020
3/26/2020
Sidney
RS
86691-710
12
Bill Adams
Flash Delivery
$4,743.00
277 Richards St.
834-7583
7/27/2019
7/29/2019
Sidney
RS
86691-710
13
John Richards
Logitrax
$3,533.00
6856 Peters St.
635-6826
3/6/2022
3/10/2022
York
SP
78404-737
14
Mark Brown
Logitrax
$1,072.00
3013 Wong St.
675-3921
11/20/2019
11/22/2019
Rome
SC
19872-628
15
Bill Adams
Logitrax
$3,909.00
277 Richards St.
834-7583
2/21/2019
2/23/2019
Sidney
RS
86691-710
16
Aaron Adams
Logitrax
$1,812.00
6799 Bannon St.
749-8404
12/1/2020
12/3/2020
Paris
SC
95460-836
17
Aaron Brown
Speedy Express
$148.00
7922 Brown St.
290-3116
8/20/2017
8/24/2017
Hamburg
SP
93593-280
18
Tony Peters
Speedy Express
$2,270.00
3604 Adams St.
405-7664
10/28/2019
10/30/2019
Rome
RT
12590-262
19
Sue Bannon
Flash Delivery
$3,867.00
404 Brown St.
546-7967
9/17/2024
9/19/2024
Paris
RS
48217-461
20
Tom Adams
Speedy Express
$857.00
6884 Adams St.
517-4373
7/26/2022
7/30/2022
York
RT
26432-811
21
Mark Brown
Logitrax
$4,416.00
3013 Wong St.
675-3921
4/20/2018
4/23/2018
Rome
SC
19872-628
22
John Wong
Flash Delivery
$1,113.00
2681 Peters St.
785-8594
12/25/2022
12/28/2022
Paris
RT
47886-824
23
Bill Adams
Flash Delivery
$4,110.00
277 Richards St.
834-7583
9/11/2021
9/12/2021
Sidney
RS
86691-710
24
Mark Peters
Speedy Express
$920.00
9757 Brown St.
220-8371
9/12/2021
9/16/2021
Florence
SC
20213-120

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