From 13dbd58afa913a822ffef5fb8781bc85d624aa3a Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 29 Jan 2020 22:05:22 +0000 Subject: [PATCH] --- ayanova/src/components/gz-data-table.vue | 90 ++++++++++++++++++------ 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 588c6b44..c3dcefa9 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -16,6 +16,56 @@ :disable-sort="true" class="elevation-1" > + @@ -124,10 +174,10 @@ export default { window.$gz.api.get(listUrl).then(res => { that.loading = false; that.totalItems = res.paging.count; - //This is how to call an async function and await it from sync code + //NOTE: This is how to call an async function and await it from sync code (async function() { //Make sure the locale keys are fetched - await fetchLocalizedHeaderNames(res.columns); + await fetchLocalizedHeaderNames(res.columns); //Note can use await here because it's wrapped inside an async function call, it will wait then resume next stuff below //build that.headers here that.headers = buildHeaders(res.columns); //Post process data here and then set that.records @@ -152,12 +202,23 @@ function buildHeaders(columnData) { var h = {}; h["text"] = window.$gz.locale.get(cm.cm); h["value"] = i; - // console.log("Adding column:"); - // console.log(h); ret.push(h); } - // console.log("Returning header array:"); - // console.log(ret); + /* +{https://vuetifyjs.com/en/components/data-tables#api see headers property for this info: + text: string + value: string + align?: 'start' | 'center' | 'end' + sortable?: boolean + filterable?: boolean + divider?: boolean + class?: string | string[] + width?: string | number + filter?: (value: any, search: string, item: any) => boolean + sort?: (a: any, b: any) => number +} + +*/ return ret; } @@ -187,24 +248,9 @@ async function fetchLocalizedHeaderNames(columnData) { }); } -/* -{ - text: string - value: string - align?: 'start' | 'center' | 'end' - sortable?: boolean - filterable?: boolean - divider?: boolean - class?: string | string[] - width?: string | number - filter?: (value: any, search: string, item: any) => boolean - sort?: (a: any, b: any) => number -} - -*/ //Called by getDataFromApi on retrieval of list with columnData function buildRecords(listData) { - //iterate columns, build headers and return + //iterate data, build each object keyed with index name and then return } //DataTable component