Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Aaron Johnson
Flash Delivery
$118.00
9624 White St.
763-6294
9/29/2019
10/1/2019
Rome
RT
67061-644
1
Tony White
Speedy Express
$1,169.00
376 Smith St.
387-4820
6/17/2023
6/18/2023
York
RT
84954-674
2
John Richards
Flash Delivery
$567.00
7738 Brown St.
285-1870
7/31/2020
8/4/2020
Florence
SP
59655-131
3
Chris Adams
Speedy Express
$1,871.00
592 Brown St.
856-7035
7/28/2018
7/29/2018
Sidney
RT
41765-400
4
Bill Wong
Flash Delivery
$1,330.00
6408 White St.
611-8507
8/31/2021
9/4/2021
Hamburg
CS
54871-803
5
Bill White
Speedy Express
$3,849.00
2510 Wong St.
548-3770
5/15/2017
5/17/2017
Paris
SC
98872-763
6
Paul Brown
Speedy Express
$2,376.00
5413 Adams St.
572-9526
9/14/2023
9/17/2023
Rome
SP
58716-691
7
John Wong
Flash Delivery
$922.00
3989 Richards St.
761-8498
7/31/2017
8/4/2017
Rome
RS
19823-379
8
Brad White
Flash Delivery
$4,218.00
746 Johnson St.
134-3055
6/19/2019
6/20/2019
Rome
RT
71729-774
9
Aaron Johnson
Flash Delivery
$3,839.00
9624 White St.
763-6294
5/8/2020
5/10/2020
Rome
RT
67061-644
10
Paul Johnson
Speedy Express
$3,165.00
9529 Peters St.
953-5214
1/19/2020
1/23/2020
Hamburg
RT
95648-171
11
Paul Brown
Logitrax
$4,044.00
5413 Adams St.
572-9526
5/22/2019
5/23/2019
Rome
SP
58716-691
12
Tom Brown
Logitrax
$1,939.00
6443 Adams St.
366-2008
10/19/2017
10/21/2017
Sidney
CS
34465-919
13
Paul White
Flash Delivery
$911.00
8951 Bannon St.
336-8979
9/18/2017
9/21/2017
York
RN
63950-572
14
Brad Wong
Speedy Express
$641.00
9948 Johnson St.
481-9393
7/7/2017
7/11/2017
Paris
RT
16277-265
15
Brad Wong
Logitrax
$269.00
9948 Johnson St.
481-9393
2/11/2022
2/12/2022
Paris
RT
16277-265
16
Bill Wong
Flash Delivery
$1,478.00
6408 White St.
611-8507
4/20/2020
4/23/2020
Hamburg
CS
54871-803
17
John Brown
Speedy Express
$2,148.00
914 Peters St.
823-5467
9/15/2021
9/16/2021
Sidney
RS
73344-742
18
Joe Wong
Flash Delivery
$1,247.00
6801 Wong St.
392-1798
5/23/2019
5/24/2019
York
SP
22619-204
19
Frank Bannon
Flash Delivery
$4,287.00
249 Johnson St.
370-4747
9/4/2021
9/7/2021
Sidney
SC
65344-650
20
Tom Bannon
Logitrax
$4,905.00
7300 Adams St.
645-1644
8/12/2024
8/13/2024
Rome
SC
11576-382
21
Frank Smith
Logitrax
$4,844.00
8031 White St.
832-4597
6/18/2019
6/21/2019
Cairo
RN
72370-132
22
Bill Bannon
Speedy Express
$764.00
9673 Adams St.
680-9198
5/3/2020
5/4/2020
Cairo
RN
31295-663
23
Bill Richards
Flash Delivery
$983.00
9184 Wong St.
346-2770
4/21/2022
4/25/2022
York
RT
61237-387
24
Aaron Johnson
Logitrax
$2,149.00
9624 White St.
763-6294
12/4/2017
12/5/2017
Rome
RT
67061-644

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