Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit a150807

Browse files
committed
feat(example): add programmatically Pagination change sample
1 parent 971ab85 commit a150807

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

src/app/examples/grid-graphql.component.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ <h2>{{title}}</h2>
2626
<b>Metrics:</b> {{metrics.endTime | date: 'yyyy-MM-dd HH:mm aaaaa\'m\''}} | {{metrics.executionTime}}ms
2727
| {{metrics.totalItemCount}} items
2828
</span>
29+
<div class="row col-md-12">
30+
<label>Programmatically go to first/last page:</label>
31+
<button class="btn btn-default btn-xs" (click)="goToFirstPage()">
32+
<i class="fa fa-caret-left fa-lg"></i>
33+
</button>
34+
<button class="btn btn-default btn-xs" (click)="goToLastPage()">
35+
<i class="fa fa-caret-right fa-lg"></i>
36+
</button>
37+
</div>
2938
</div>
3039
<div class="col-sm-7">
3140
<div class="alert alert-info" data-test="alert-graphql-query">

src/app/examples/grid-graphql.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ export class GridGraphqlComponent implements OnInit, OnDestroy {
239239
});
240240
}
241241

242+
goToFirstPage() {
243+
this.angularGrid.paginationService.goToFirstPage();
244+
}
245+
246+
goToLastPage() {
247+
this.angularGrid.paginationService.goToLastPage();
248+
}
249+
242250
/** Dispatched event of a Grid State Changed event */
243251
gridStateChanged(gridStateChanges: GridStateChange) {
244252
console.log('Client sample, Grid State changed:: ', gridStateChanges);

src/app/examples/grid-odata.component.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ <h2>{{title}}</h2>
3838
</label>
3939
</div>
4040
</div>
41+
<div class="row col-md-12">
42+
<label>Programmatically go to first/last page:</label>
43+
<button class="btn btn-default btn-xs" (click)="goToFirstPage()">
44+
<i class="fa fa-caret-left fa-lg"></i>
45+
</button>
46+
<button class="btn btn-default btn-xs" (click)="goToLastPage()">
47+
<i class="fa fa-caret-right fa-lg"></i>
48+
</button>
49+
</div>
4150

4251
<angular-slickgrid gridId="grid5" [columnDefinitions]="columnDefinitions" [gridOptions]="gridOptions"
4352
[dataset]="dataset" (onGridStateChanged)="gridStateChanged($event)"

src/app/examples/grid-odata.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ export class GridOdataComponent implements OnInit {
153153
return this.getCustomerDataApiMock(query);
154154
}
155155

156+
goToFirstPage() {
157+
this.angularGrid.paginationService.goToFirstPage();
158+
}
159+
160+
goToLastPage() {
161+
this.angularGrid.paginationService.goToLastPage();
162+
}
163+
156164
/** This function is only here to mock a WebAPI call (since we are using a JSON file for the demo)
157165
* in your case the getCustomer() should be a WebAPI function returning a Promise
158166
*/

0 commit comments

Comments
 (0)