This commit is contained in:
2020-01-31 16:07:22 +00:00
parent a9ab5a4203
commit 350f831181
3 changed files with 26 additions and 25 deletions

View File

@@ -48,7 +48,6 @@ CURRENT TODOs
SHELL / NAV / MENUS / LAYOUT
TODO: Test single select still wroking after recent changes
TODO: Save grid settings on paging changes, when open grid get last paging so editing records doesn't lose your position when you come back
- Also scrollposition
TODO: toolbar above grid for filters, refresh etc (make it a standard component?)

View File

@@ -649,7 +649,8 @@ export default {
// for form specified or empty object if there is none
// EAch form is responsible for what it stores and how it initializes, this just provides that
// the form does the actual work of what settings it requires
// Form settings are temp and saved, saved ones go into vuex and localstorage and temporary ones are stored in session storage
// Form settings are temp and saved, saved ones go into vuex and localstorage and persist a refresh
// and temporary ones are stored in session storage and don't persist a refresh
//
getFormSettings(formKey) {
return {

View File

@@ -5,7 +5,7 @@
:headers="headers"
:items="records"
v-model="selected"
:options.sync="options"
:options.sync="dataTablePagingOptions"
:server-items-length="totalRecords"
:loading="loading"
:disable-sort="true"
@@ -98,7 +98,7 @@ export default {
data() {
return {
loading: true,
options: {},
dataTablePagingOptions: {},
headers: [],
serverColumns: [],
totalRecords: 0,
@@ -129,7 +129,7 @@ export default {
}
},
watch: {
options: {
dataTablePagingOptions: {
handler() {
this.getDataFromApi();
},
@@ -165,8 +165,6 @@ export default {
//i is the actual AyaNova index of that record so we have all we need to open that object
window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i });
// this.$emit("OPENOBJECT", { type: typeToOpen, id: i });
// alert("STUB: Open object type " + typeToOpen + " with record id of " + i);
},
lt(ltKey) {
return window.$gz.locale.get(ltKey);
@@ -182,22 +180,7 @@ export default {
//debugger;
var that = this;
// //set the list settings in the store since we were successful at retrieval
// if (
// that.localFormSettings &&
// that.localFormSettings.pagination &&
// that.localFormSettings.pagination.itemsPerPage
// ) {
// window.$gz.form.setFormSettings(that.formKey, {
// temp: { page: that.localFormSettings.pagination.page },
// saved: {
// itemsPerPage: that.localFormSettings.pagination.itemsPerPage,
// sortBy: that.localFormSettings.pagination.sortBy,
// descending: that.localFormSettings.pagination.descending
// }
// });
// }
//DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=999&DataFilterId=1&mini=true
//start with defaults
@@ -207,7 +190,7 @@ export default {
Offset: 0
};
//calculate paging based on settings
const { page, itemsPerPage } = that.options;
const { page, itemsPerPage } = that.dataTablePagingOptions;
if (itemsPerPage && itemsPerPage > 0) {
listOptions.Offset = (page - 1) * itemsPerPage;
listOptions.Limit = itemsPerPage;
@@ -240,10 +223,28 @@ export default {
that.records = buildRecords(
res.data,
res.columns,
that.$options.filters
that.$options.filters //this is the VUE filters collection, nothing to do with the local data structure
);
that.loading = false;
that.totalRecords = res.paging.count;
//set the list settings in the store since we were successful at retrieval
if (
that.localFormSettings &&
that.localFormSettings.pagination &&
that.localFormSettings.pagination.itemsPerPage
) {
window.$gz.form.setFormSettings(that.formKey, {
temp: { page: that.localFormSettings.pagination.page },
saved: {
itemsPerPage: that.localFormSettings.pagination.itemsPerPage,
sortBy: that.localFormSettings.pagination.sortBy,
descending: that.localFormSettings.pagination.descending
}
});
}
})();
});
}