From 67cd3ccbf277fc7498df1f9c65549a22d67c832d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 1 Feb 2021 22:37:40 +0000 Subject: [PATCH] --- ayanova/src/components/data-table.vue | 33 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/ayanova/src/components/data-table.vue b/ayanova/src/components/data-table.vue index 03c6ad90..000d620f 100644 --- a/ayanova/src/components/data-table.vue +++ b/ayanova/src/components/data-table.vue @@ -3,7 +3,7 @@ {{ dataTablePagingOptions }} - + {{ headers }} { + //Pull column header name "value" from "fk"matching "key" here from this.headers columns.c0 etc here from this.headers see above method + sortBy.push(this.headers.find(z => z.fk == key).value); + + //if not null then push into the sortBy array + let sort = rsort[key]; + if (sort == "-") { + sortDesc.push(true); + } else { + sortDesc.push(false); + } + // console.log(`${key}: ${rsort[key]}`); + }); + } + //vm.selected = [...preSelected]; + this.dataTablePagingOptions.sortBy = [...sortBy]; + this.dataTablePagingOptions.sortDesc = [...sortDesc]; + console.log("setsortindicator:", { sortBy: sortBy, sortDesc: sortDesc }); // { // "sortBy": { // "customername": "-", @@ -524,6 +545,10 @@ export default { // "customeremail": "-" // } // } + //to this + // + //this.dataTablePagingOptions.sortDesc + //{ "page": 1, "itemsPerPage": 10, "sortBy": [ "columns.c0", "columns.c1", "columns.c2" ], "sortDesc": [ false, false, true ], "groupBy": [], "groupDesc": [], "mustSort": false, "multiSort": true } }, refresh() { this.getDataFromApi();