FlexGrid
FlexGrid
Paging
This sample shows how to implement paged views with the FlexGrid.
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 FlexGrid or CollectionViewService.
To switch pages, use the Pager Control and set Pager.Owner property to the id of FlexGrid or CollectionViewService.
Note: That the paging UI is implemented outside of the grid.
Features
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
Img
Rank
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
Img
Rank
1
1/25/2025
1/25/2025
German
Gadget
Green
581.61
1,030.17
0.14
https://en.wikipedia.org/wiki/Tourism_in_German
https://cdn.grapecity.com/wijmo/images/1.png
4
2
2/25/2025
2/25/2025
Italy
Gadget
Green
-4,673.75
3,499.71
0.13
https://en.wikipedia.org/wiki/Tourism_in_Italy
https://cdn.grapecity.com/wijmo/images/2.png
2
3
3/25/2025
3/25/2025
China
Gadget
Black
-2,265.49
4,535.49
0.20
https://en.wikipedia.org/wiki/Tourism_in_China
https://cdn.grapecity.com/wijmo/images/3.png
5
4
4/25/2025
4/25/2025
France
Widget
Green
3,964.40
432.90
0.21
https://en.wikipedia.org/wiki/Tourism_in_France
https://cdn.grapecity.com/wijmo/images/4.png
1
5
5/25/2025
5/25/2025
UK
Widget
Red
-1,744.99
3,355.18
0.12
https://en.wikipedia.org/wiki/Tourism_in_UK
https://cdn.grapecity.com/wijmo/images/1.png
1
6
6/25/2025
6/25/2025
France
Gadget
Red
4,276.37
1,106.71
0.23
https://en.wikipedia.org/wiki/Tourism_in_France
https://cdn.grapecity.com/wijmo/images/2.png
2
7
7/25/2025
7/25/2025
US
Widget
Green
-4,376.92
1,408.24
0.18
https://en.wikipedia.org/wiki/Tourism_in_US
https://cdn.grapecity.com/wijmo/images/3.png
1
8
8/25/2025
8/25/2025
Japan
Gadget
Black
1,996.52
3,077.04
0.21
https://en.wikipedia.org/wiki/Tourism_in_Japan
https://cdn.grapecity.com/wijmo/images/4.png
4
9
9/25/2025
9/25/2025
Korea
Widget
Red
-3,442.35
4,068.26
0.16
https://en.wikipedia.org/wiki/Tourism_in_Korea
https://cdn.grapecity.com/wijmo/images/1.png
3
10
10/25/2025
10/25/2025
US
Widget
Green
-2,973.96
4,568.15
0.01
https://en.wikipedia.org/wiki/Tourism_in_US
https://cdn.grapecity.com/wijmo/images/2.png
5
11
11/25/2025
11/25/2025
Canada
Widget
Green
-3,217.79
4,414.46
0.14
https://en.wikipedia.org/wiki/Tourism_in_Canada
https://cdn.grapecity.com/wijmo/images/3.png
2
12
12/25/2025
12/25/2025
UK
Gadget
Red
1,556.19
1,705.14
0.01
https://en.wikipedia.org/wiki/Tourism_in_UK
https://cdn.grapecity.com/wijmo/images/4.png
2
13
1/25/2025
1/25/2025
Canada
Gadget
Red
-4,981.75
4,917.13
0.24
https://en.wikipedia.org/wiki/Tourism_in_Canada
https://cdn.grapecity.com/wijmo/images/1.png
5
14
2/25/2025
2/25/2025
China
Gadget
Green
-397.56
1,702.41
0.19
https://en.wikipedia.org/wiki/Tourism_in_China
https://cdn.grapecity.com/wijmo/images/2.png
4
15
3/25/2025
3/25/2025
Italy
Widget
Green
199.60
4,148.18
0.14
https://en.wikipedia.org/wiki/Tourism_in_Italy
https://cdn.grapecity.com/wijmo/images/3.png
4
0
loading...
Settings
Description
This sample shows how to implement paged views with the FlexGrid. 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 FlexGrid or CollectionViewService. To switch pages, use the Pager Control and set Pager.Owner property to the id of FlexGrid or CollectionViewService.
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 | using C1.Web.Mvc; using C1.Web.Mvc.Serialization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using MvcExplorer.Models; using Microsoft.AspNetCore.Http; namespace MvcExplorer.Controllers { public partial class FlexGridController : Controller { private readonly ControlOptions _gridPagingModel = new ControlOptions { Options = new OptionDictionary { { "Page Size" , new OptionItem {Values = new List< string > { "10" , "25" , "50" , "100" }, CurrentValue = "25" }}, } }; public ActionResult Paging(IFormCollection data) { _gridPagingModel.LoadPostData(data); ViewBag.DemoOptions = _gridPagingModel; return View(); } public ActionResult Paging_Bind([C1JsonRequest] CollectionViewRequest<Sale> requestData) { return this .C1Json(CollectionViewHelper.Read(requestData, Sale.GetData(500))); } } } |
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 | @model IEnumerable< Sale > @ { ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; } @section Styles{ < style > .customGrid { 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-flex-grid height = "300px" id = "pagingGrid" class = "customGrid" is-read-only = "true" items-source-id = "collectionViewService" > </ c1-flex-grid > < c1-pager owner = "pagingGrid" ></ c1-pager > @section Settings{ @await Html.PartialAsync( "_OptionsMenu" , optionsModel) } @section Description{ < p > @Html .Raw(FlexGridRes.Paging_Text0)</ p > < p > @Html .Raw(FlexGridRes.Paging_Text1)</ p > } |