test_to_dev #1513

Merged
alexm merged 12 commits from test_to_dev into dev 2023-05-10 10:41:12 +00:00
1 changed files with 12 additions and 12 deletions
Showing only changes of commit 7a668adf18 - Show all commits

View File

@ -126,20 +126,20 @@ export default class CrudModel extends ModelProxy {
}
}
loadMore(overwrite) {
loadMore(append) {
if (!this.moreRows)
return this.$q.resolve();
const filter = Object.assign({}, this.currentFilter);
if (overwrite)
if (append)
filter.skip = this.orgData ? this.orgData.length : 0;
if (!overwrite) {
if (!append) {
this.page += 1;
filter.limit = this.page * this.limit;
}
return this.sendRequest(filter, overwrite, true);
return this.sendRequest(filter, append, true);
}
clear() {
@ -231,10 +231,10 @@ export default class CrudModel extends ModelProxy {
return params;
}
sendRequest(filter, overwrite, loadMore) {
sendRequest(filter, append, loadMore) {
this.cancelRequest();
this.canceler = this.$q.defer();
this.isPaging = overwrite;
this.isPaging = append;
if (!loadMore)
this.status = 'loading';
@ -249,16 +249,16 @@ export default class CrudModel extends ModelProxy {
};
return this.$http.get(this._url, options).then(
json => this.onRemoteDone(json, filter, overwrite),
json => this.onRemoteError(json, overwrite)
json => this.onRemoteDone(json, filter, append),
json => this.onRemoteError(json, append)
).finally(() => {
this.isPaging = false;
});
}
onRemoteDone(json, filter, overwrite) {
onRemoteDone(json, filter, append) {
let data = json.data;
if (overwrite)
if (append)
this.orgData = this.orgData.concat(data);
else {
this.orgData = data;
@ -269,8 +269,8 @@ export default class CrudModel extends ModelProxy {
this.onRequestEnd();
}
onRemoteError(err, overwrite) {
if (!overwrite) {
onRemoteError(err, append) {
if (!append) {
this.clear();
this.status = 'error';
}