This commit is contained in:
2021-02-01 19:54:59 +00:00
parent d4a7cd9dcd
commit 0399f5d966
2 changed files with 22 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ MISC ITEMS THAT CAME UP
LISTVIEW REPLACE CURRENT <----HERE not THERE ---v
(below this is all past for reference)
Update datatable to send to server sort changes
update server to return columnview with response data
update client to adapt ui to returned columnview
.......

View File

@@ -3,6 +3,7 @@
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-card>
{{ dataTablePagingOptions }}
{{ headers }}
<v-card-title>
<v-select
v-model="listViewId"
@@ -464,12 +465,18 @@ export default {
if (sortHasChanged) {
//update sort at server and then allow get data
console.log("1 calling api method");
let res = await window.$gz.api.get(
"data-list/listfields?DataListKey=" + this.dataListKey
);
console.log("2 inside sorthaschange back from api method", res);
//this would normally never fail and no return data is required here
//because getdatafromapi will have the data to refresh the sort of the view anyway
//so it's fire and forget
await window.$gz.api.post("data-list-column-view/new-sort", {
listKey: this.dataListKey,
sortBy: this.keyArrayFromSortByArray(
this.dataTablePagingOptions.sortBy
),
sortDesc: this.dataTablePagingOptions.sortDesc
});
}
console.log("3 About to call getdata from api");
console.log("2 About to call getdata from api");
//has changed something important so refetch and put a pin in last paging settings for next time
this.getDataFromApi();
this.lastDataTablePagingOptions = this.dataTablePagingOptions;
@@ -501,6 +508,14 @@ export default {
}
return "";
},
keyArrayFromSortByArray(sortBy) {
return sortBy.map(sortItem => {
let val = this.headers.find(z => z.value == sortItem);
if (val) {
return val.key;
}
});
},
refresh() {
this.getDataFromApi();
},
@@ -636,10 +651,6 @@ export default {
return null;
}
},
async handleSortChange(){
//update sort settings at server for current columnview
},
async getDataFromApi(deSelectAll) {
let vm = this;
@@ -745,6 +756,7 @@ function buildHeaders(columnData) {
let cm = columnData[i];
let h = {};
h.text = window.$gz.translation.get(cm.cm);
h.key = cm.cm;
h.value = "columns.c" + i.toString(); //+".v";
if (i == 0) {
h.align = "start";