Features

Filtering

Filtering

This view shows how to use filtering in MultiRow.

Features

Ordered
Shipped
City
State
Zip
Express
0
Joe Richards
Logitrax
$3,886.00
158 Brown St.
780-4085
11/1/2024
11/4/2024
Rome
SP
19559-978
1
John Smith
Speedy Express
$941.00
2512 Smith St.
803-3315
3/23/2023
3/26/2023
Sidney
SC
19286-637
2
Aaron Smith
Speedy Express
$4,822.00
7482 Bannon St.
687-8191
9/26/2020
9/29/2020
Hamburg
RS
34030-127
3
Sue Peters
Logitrax
$480.00
9301 Johnson St.
544-6214
2/2/2018
2/6/2018
Cairo
SC
48459-380
4
Mark Smith
Speedy Express
$3,257.00
2469 Johnson St.
443-4510
6/26/2022
6/27/2022
Hamburg
RS
99988-423
5
Brad Adams
Logitrax
$495.00
8061 White St.
477-2236
9/22/2022
9/25/2022
York
SC
36206-780
6
Tony White
Speedy Express
$259.00
9440 Richards St.
229-6507
7/13/2023
7/14/2023
Florence
SP
82685-159
7
Sue Johnson
Logitrax
$4,686.00
4443 Bannon St.
705-6863
12/18/2017
12/20/2017
York
RT
60568-663
8
Brad Bannon
Logitrax
$755.00
9115 Smith St.
621-4474
8/11/2020
8/15/2020
Sidney
SC
57517-514
9
Bill Smith
Flash Delivery
$2,382.00
318 Peters St.
837-6874
4/26/2024
4/27/2024
York
SP
89574-780
10
Bill White
Speedy Express
$769.00
5312 Bannon St.
806-9028
9/9/2022
9/11/2022
Florence
RT
14701-467
11
Joe Richards
Flash Delivery
$1,782.00
6610 Richards St.
462-3849
1/2/2018
1/6/2018
Sidney
CS
37808-619
12
Paul Bannon
Speedy Express
$653.00
2866 Richards St.
761-6815
12/2/2020
12/4/2020
Cairo
SC
22692-258
13
Sue Peters
Speedy Express
$2,374.00
9301 Johnson St.
544-6214
2/5/2022
2/8/2022
Cairo
SC
48459-380
14
Bill Smith
Speedy Express
$1,617.00
318 Peters St.
837-6874
5/28/2020
6/1/2020
York
SP
89574-780
15
Frank Bannon
Logitrax
$4,535.00
2026 Smith St.
339-7063
12/20/2020
12/21/2020
Florence
RT
75999-750
16
Frank Bannon
Flash Delivery
$4,109.00
2552 Bannon St.
727-3550
2/18/2023
2/20/2023
Florence
RT
39436-935
17
Frank Bannon
Speedy Express
$2,472.00
2552 Bannon St.
727-3550
4/19/2018
4/20/2018
Florence
RT
39436-935
18
Frank Bannon
Speedy Express
$2,472.00
9154 Richards St.
418-6294
5/4/2025
5/8/2025
Florence
CS
99488-838
19
Tony Adams
Flash Delivery
$2,608.00
8786 Peters St.
950-5022
5/12/2024
5/15/2024
Rome
RT
87138-278
20
Sue Brown
Speedy Express
$2,276.00
989 Bannon St.
223-3965
12/2/2020
12/5/2020
Rome
SP
63083-595
21
John Smith
Flash Delivery
$4,463.00
2512 Smith St.
803-3315
12/25/2021
12/26/2021
Sidney
SC
19286-637
22
Bill White
Speedy Express
$3,476.00
5312 Bannon St.
806-9028
4/17/2018
4/21/2018
Florence
RT
14701-467
23
Frank Richards
Speedy Express
$3,514.00
2703 White St.
735-5550
12/31/2022
1/3/2023
Hamburg
SP
47740-511
24
Tony Adams
Speedy Express
$351.00
8786 Peters St.
950-5022
5/6/2022
5/7/2022
Rome
RT
87138-278

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