Skip to content

Commit

Permalink
preserve filter during pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Aug 15, 2019
1 parent c738019 commit 778631c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/app/src/app.js
Expand Up @@ -885,6 +885,8 @@ async function _displayList(ctx, parentInfo) {
if (pnum > model.opts.page) {
return _loadFromServer(url);
}
} else if (filter && pnum > model.opts.page) {
filter.page = pnum;
}

if (!pnum && !model.opts.client) {
Expand Down Expand Up @@ -924,20 +926,19 @@ async function _displayList(ctx, parentInfo) {
var prevIsLocal, currentIsLocal;

if (pnum > model.opts.page && (model.opts.client || pnum > 1)) {
prev = conf.url + '/';
if (+pnum - 1 > model.opts.page && (model.opts.client || pnum > 2)) {
prev +=
'?' +
$.param({
page: +pnum - 1
});
let prevp = filter ? { ...filter } : {};
prevp.page = +pnum - 1;
prev = conf.url + '/?' + $.param(prevp);
} else if (pnum == 1) {
prev = conf.url + '/';
prevIsLocal = true;
}
}

if (pnum < data.pages && (model.opts.server || pnum)) {
var nextp = { page: +pnum + 1 };
let nextp = filter ? { ...filter } : {};
nextp.page = +pnum + 1;
next = conf.url + '/?' + $.param(nextp);
if (nextp.page == 1) {
currentIsLocal = true;
Expand Down

0 comments on commit 778631c

Please sign in to comment.