This commit is contained in:
2019-06-05 18:38:30 +00:00
parent 47d037dc76
commit 65967d4992
4 changed files with 58 additions and 20 deletions

View File

@@ -97,15 +97,31 @@ export default {
});
})
.then(() => {
var storedFormSettings = that.$gzform.getFormSettings(FORM_KEY);
var formSettings = that.$gzform.getFormSettings(FORM_KEY);
/**
* {
temp: { page: that.localFormSettings.pagination.page },
saved: {
rowsPerPage: that.localFormSettings.pagination.rowsPerPage,
sortBy: that.localFormSettings.pagination.sortBy,
descending: that.localFormSettings.pagination.descending
}
}
*/
//set default values for form settings if they are not present yet
if (!storedFormSettings) {
storedFormSettings = {
if (!formSettings.saved || !formSettings.saved.rowsPerPage) {
that.localFormSettings = {
pagination: {}
};
} else {
that.localFormSettings = storedFormSettings;
that.localFormSettings.pagination = {
rowsPerPage: formSettings.saved.rowsPerPage,
sortBy: formSettings.saved.sortBy,
descending: formSettings.saved.descending
};
if (formSettings.temp && formSettings.temp.page) {
that.localFormSettings.pagination.page = formSettings.temp.page;
}
}
that.formState.ready = true;
@@ -192,7 +208,14 @@ export default {
that.localFormSettings.pagination &&
that.localFormSettings.pagination.rowsPerPage
) {
that.$gzform.setFormSettings(FORM_KEY, that.localFormSettings);
that.$gzform.setFormSettings(FORM_KEY, {
temp: { page: that.localFormSettings.pagination.page },
saved: {
rowsPerPage: that.localFormSettings.pagination.rowsPerPage,
sortBy: that.localFormSettings.pagination.sortBy,
descending: that.localFormSettings.pagination.descending
}
});
}
this.loading = true;