This commit is contained in:
2020-01-30 21:09:58 +00:00
parent bee44c0fd2
commit 462e6d2f93

View File

@@ -44,7 +44,9 @@
<template v-if="c.t < 9"> <template v-if="c.t < 9">
<template v-if="c.i"> <template v-if="c.i">
<!-- openable object with an ID --> <!-- openable object with an ID -->
<v-btn depressed small>{{ c.v }}</v-btn> <v-btn depressed small @click="btnClick(c.key, c.i)">{{
c.v
}}</v-btn>
</template> </template>
<template v-else> <template v-else>
{{ c.v }} {{ c.v }}
@@ -88,6 +90,7 @@ export default {
loading: true, loading: true,
options: {}, options: {},
headers: [], headers: [],
serverColumns: [],
totalRecords: 0, totalRecords: 0,
records: [], records: [],
rowsPerPageItems: [5, 10, 25, 50, 100], rowsPerPageItems: [5, 10, 25, 50, 100],
@@ -124,18 +127,14 @@ export default {
} }
}, },
methods: { methods: {
test(item) { btnClick(key, i) {
console.log(item); //translate key to actual object type from header data
/* //key format is row-column e.g."500-2"
<tr v-for="item in items" :key="item.name"> //get the datatype of the column which matches the server columns array index
<td>{{ test(item) }}</td> var typeToOpen = this.serverColumns[key.split("-")[1]].ay;
<td>CONTENT</td>
<td>CONTENT</td> //i is the actual AyaNova index of that record so we have all we need to open that object
<td>CONTENT</td> alert("STUB: Open object type " + typeToOpen + " with record id of " + i);
<td>CONTENT</td>
<td>CONTENT</td>
</tr> */
debugger;
}, },
lt(ltKey) { lt(ltKey) {
return window.$gz.locale.get(ltKey); return window.$gz.locale.get(ltKey);
@@ -199,6 +198,8 @@ export default {
window.$gz.api.get(listUrl).then(res => { window.$gz.api.get(listUrl).then(res => {
//NOTE: 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() { (async function() {
//Save a copy of the server columns data for handling button clicks etc later
that.serverColumns = res.columns;
//Make sure the locale keys are fetched //Make sure the locale keys are fetched
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 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 //build that.headers here