Features

Paging

Paging

This sample shows how to implement paged views with the MultiRow.All the work is done by the CollectionView class used as a data source for the grid.To enable paging, set the PageSize property of MultiRow or CollectionViewService.To switch pages, use the Pager control and set Pager.Owner property to the id of MultiRow or CollectionViewService.

Features

Ordered
Shipped
City
State
Zip
Express
0
Brad Adams
Flash Delivery
$4,519.00
8720 Peters St.
127-2344
4/30/2023
5/4/2023
Rome
RT
43968-219
1
John Adams
Flash Delivery
$1,119.00
1757 Richards St.
965-8710
3/21/2025
3/23/2025
Florence
SP
23525-736
2
Chris Wong
Logitrax
$4,000.00
4628 Peters St.
789-2724
11/21/2019
11/22/2019
Paris
RT
52718-953
3
Paul Bannon
Logitrax
$3,924.00
5943 Johnson St.
807-3124
11/1/2023
11/4/2023
Paris
SP
35174-916
4
Joe Smith
Logitrax
$2,982.00
7764 Richards St.
151-9646
12/23/2020
12/27/2020
Paris
SC
71944-218
5
Tom White
Speedy Express
$1,837.00
5238 Richards St.
864-6583
12/29/2021
1/1/2022
York
CS
23623-457
6
John White
Flash Delivery
$4,513.00
7924 White St.
196-9290
7/18/2018
7/21/2018
York
CS
75254-715
7
John Johnson
Speedy Express
$4,530.00
8988 Adams St.
845-5073
6/7/2022
6/9/2022
York
SP
23001-423
8
Paul White
Flash Delivery
$4,245.00
3709 Brown St.
769-4765
5/6/2025
5/8/2025
Hamburg
RT
62710-501
9
Tom White
Logitrax
$1,334.00
9633 Wong St.
499-4202
4/15/2020
4/16/2020
York
RT
73834-811

Settings

Description

This sample shows how to implement paged views with the MultiRow.
All the work is done by the CollectionView class used as a data source for the grid.
To enable paging, set the PageSize property of MultiRow or CollectionViewService.
To switch pages, use the Pager control and set Pager.Owner property to the id of MultiRow or CollectionViewService.

In this example, the paging happens server-side. This is because CollectionView here acts like a service and synchronizes with server data. The CollectionView internally does an ajax call to fetch next set of data. Refer @Html.ActionLink("Disable Server Reading", "DisableServerRead") sample for client-side paging.

Note: That the paging UI is implemented outside of the grid. This gives you complete control over the appearance and functionality of the paging mechanism.
To customize the Pager by Javascript, please refer the client CollectionView class.

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
using System.Collections.Generic;
using C1.Web.Mvc;
using C1.Web.Mvc.Serialization;
using Microsoft.AspNetCore.Mvc;
using MultiRowExplorer.Models;
using Microsoft.AspNetCore.Http;
  
namespace MultiRowExplorer.Controllers
{
    public partial class MultiRowController : Controller
    {
        private readonly ControlOptions _pagingOptions = new ControlOptions
        {
            Options = new OptionDictionary
            {
                {"Page Size", new OptionItem {Values = new List<string> {"10", "25", "50", "100"}, CurrentValue = "10"}},
            }
        };
  
        public ActionResult Paging(IFormCollection data)
        {
            _pagingOptions.LoadPostData(data);
            ViewBag.DemoOptions = _pagingOptions;
            return View();
        }
  
  
        public ActionResult Paging_Bind([C1JsonRequest] CollectionViewRequest<Orders.Order> requestData)
        {
            return this.C1Json(CollectionViewHelper.Read(requestData, Orders.GetOrders()));
        }
    }
}
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
55
56
57
58
59
60
@model IEnumerable<Orders.Order>
@{
    var cities = Orders.GetCities().ToValues();
    ControlOptions optionsModel = ViewBag.DemoOptions;
    ViewBag.DemoSettings = true;
}
  
@section Styles{
    <style>
        .customMultiRow {
            margin-top: 5px;
        }
    </style>
}
  
<c1-items-source id="collectionViewService" read-action-url="@Url.Action("Paging_Bind")" page-size="@Convert.ToInt32(optionsModel.Options["pageSize"].CurrentValue)"></c1-items-source>
  
<c1-pager owner="collectionViewService"></c1-pager>
  
<c1-multi-row id="pagingMultiRow" class="multirow customMultiRow" is-read-only="true" items-source-id="collectionViewService">
    <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-multi-row>
  
<c1-pager owner="pagingMultiRow"></c1-pager>
  
@section Settings{
    @Html.Partial("_OptionsMenu", optionsModel)
}
  
@section Description{
<p>@Html.Raw(MultiRowRes.Paging_Text0)</p>
  
<p>@Html.Raw(MultiRowRes.Paging_Text1)</p>
  
<p>@Html.Raw(MultiRowRes.Paging_Text2)</p>
  
}