Skip to content

Commit

Permalink
fix(demo): out of boundaries page Grid Preset should be unset (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored May 23, 2024
1 parent 6fbae19 commit e1a4d46
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/demo/src/examples/slickgrid/example31.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class Example31 {
}

// Read the result field from the JSON response.
const firstRow = skip;
let firstRow = skip;
let filteredData = data;
if (columnFilters) {
for (const columnId in columnFilters) {
Expand Down Expand Up @@ -322,6 +322,12 @@ export class Example31 {
}
countTotalItems = filteredData.length;
}

// make sure page skip is not out of boundaries, if so reset to first page & remove skip from query
if (firstRow > filteredData.length) {
query = query.replace(`$skip=${firstRow}`, '');
firstRow = 0;
}
const updatedData = filteredData.slice(firstRow, firstRow + top!);

setTimeout(() => {
Expand Down
8 changes: 7 additions & 1 deletion packages/demo/src/examples/slickgrid/example5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class Example5 {
}

// Read the result field from the JSON response.
const firstRow = skip;
let firstRow = skip;
let filteredData = data;
if (columnFilters) {
for (const columnId in columnFilters) {
Expand Down Expand Up @@ -327,6 +327,12 @@ export class Example5 {
}
countTotalItems = filteredData.length;
}

// make sure page skip is not out of boundaries, if so reset to first page & remove skip from query
if (firstRow > filteredData.length) {
query = query.replace(`$skip=${firstRow}`, '');
firstRow = 0;
}
const updatedData = filteredData.slice(firstRow, firstRow + top!);

setTimeout(() => {
Expand Down

0 comments on commit e1a4d46

Please sign in to comment.