Skip to content

Commit 83887c5

Browse files
committed
chore(Samples): update samples with new def of pagination in th grid
1 parent 7b9d2bb commit 83887c5

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/app/grid-cellEditing/grid-cellEditing.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ <h3>Grid with primary key ProductID</h3>
3737
</igx-column>
3838
<igx-column field="Discontinued" header="Discontinued" [dataType]="'boolean'" width="200px" [hasSummary]="true" [editable]="true" [resizable]="true" [movable]="true">
3939
</igx-column>
40+
<igx-paginator></igx-paginator>
4041
</igx-grid>
4142
<input id="updBtn" type="button" (click)="updRecord()" value="Update cell/record">
4243
<button (click)="addRow()">Add Row</button>

src/app/grid-column-moving/grid-column-moving.sample.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<div class="density-chooser">
1313
<igx-buttongroup [values]="displayDensities" (selected)="selectDensity($event)"></igx-buttongroup>
1414
</div>
15+
<button (click)="pagingEnabled = !pagingEnabled">Enable Paging</button>
1516
<igx-grid
1617
#grid1
1718
[columnSelection]="'single'"
@@ -23,7 +24,6 @@
2324
(columnMovingEnd)="columnMovingEnd()"
2425
[rowSelection] ="'multiple'"
2526
[filterMode]="'excelStyleFilter'"
26-
[paging]="true"
2727
[rowEditable]="true"
2828
[width]="'900px'"
2929
[primaryKey]="'ID'"
@@ -50,6 +50,8 @@
5050
[hasSummary]="c.summary"
5151
[dataType]="c.type">
5252
</igx-column>
53+
<igx-paginator *ngIf="pagingEnabled" [totalRecords]="grid1.totalRecords">
54+
</igx-paginator>
5355
</igx-grid>
5456
Drag mode: {{ grid1.selectionService.dragMode }}
5557
<div class="sample-buttons">
@@ -59,6 +61,8 @@
5961
<button igxButton="raised" (click)="grid1.getSelectedData()">Get Selected Data</button>
6062
<button igxButton="raised" (click)="grid1.getSelectedRanges()">Get Selected Ranges</button>
6163
</div>
64+
<igx-paginator *ngIf="pagingEnabled" [totalRecords]="35" >
65+
</igx-paginator>
6266

6367
<span>Grid with MCH</span>
6468
<div class="sample-wrapper">

src/app/grid-column-moving/grid-column-moving.sample.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class GridColumnMovingSampleComponent implements OnInit {
1919
public gridMCHNewIndex = 0;
2020
public density: DisplayDensity = 'comfortable';
2121
public displayDensities;
22+
public pagingEnabled = false;
2223

2324
public mchData = [
2425
/* eslint-disable max-len */

src/app/grid/grid.sample.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export class GridSampleComponent implements OnInit, AfterViewInit {
9999
this.grid2.sortingExpressions = [];
100100
this.grid3.sortingExpressions = [{ fieldName: 'ProductID', dir: SortingDirection.Desc, ignoreCase: true,
101101
strategy: DefaultSortingStrategy.instance() }];
102-
this.grid3.paging = true;
103102

104103
this.selectionMode = GridSelectionMode.multiple;
105104
}
@@ -137,21 +136,15 @@ export class GridSampleComponent implements OnInit, AfterViewInit {
137136
}
138137

139138
public onPagination(event) {
140-
if (!this.grid2.paging) {
141-
return;
142-
}
143139
const total = this.grid2.data.length;
144140
const state = this.grid2.pagingState;
145141
if ((state.recordsPerPage * event) >= total) {
146142
return;
147143
}
148-
this.grid2.paginate(event);
144+
this.grid2.paginator.paginate(event);
149145
}
150146

151147
public onPerPage(event) {
152-
if (!this.grid2.paging) {
153-
return;
154-
}
155148
const total = this.grid2.data.length;
156149
const state = this.grid2.pagingState;
157150
if ((state.index * event) >= total) {

0 commit comments

Comments
 (0)