fix: after load more on refresh gets duplicate data
This commit is contained in:
parent
c961ea856b
commit
af7dc6b774
1 changed files with 8 additions and 1 deletions
|
|
@ -391,9 +391,10 @@ frappe.views.BaseList = class BaseList {
|
|||
$this.addClass("btn-info");
|
||||
|
||||
this.start = 0;
|
||||
this.page_length = $this.data().value;
|
||||
this.page_length = this.selected_page_count = $this.data().value;
|
||||
} else if ($this.is(".btn-more")) {
|
||||
this.start = this.start + this.page_length;
|
||||
this.page_length = this.selected_page_count || 20;
|
||||
}
|
||||
this.refresh();
|
||||
});
|
||||
|
|
@ -474,6 +475,7 @@ frappe.views.BaseList = class BaseList {
|
|||
this.render();
|
||||
this.after_render();
|
||||
this.freeze(false);
|
||||
this.reset_defaults();
|
||||
if (this.settings.refresh) {
|
||||
this.settings.refresh(this);
|
||||
}
|
||||
|
|
@ -500,6 +502,11 @@ frappe.views.BaseList = class BaseList {
|
|||
this.data = this.data.uniqBy((d) => d.name);
|
||||
}
|
||||
|
||||
reset_defaults() {
|
||||
this.page_length = this.page_length + this.start;
|
||||
this.start = 0;
|
||||
}
|
||||
|
||||
freeze() {
|
||||
// show a freeze message while data is loading
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue