This commit is contained in:
2020-02-18 00:00:45 +00:00
parent 74439f778f
commit ca4d8d71b7
2 changed files with 43 additions and 49 deletions

View File

@@ -3,10 +3,12 @@
<v-card> <v-card>
<v-card-title> <v-card-title>
<v-select <v-select
v-model="listViewId"
:items="pickLists.listViews" :items="pickLists.listViews"
item-text="name" item-text="name"
item-value="id" item-value="id"
:label="lt('DataListView')" :label="lt('DataListView')"
@change="listViewChanged"
> >
</v-select> </v-select>
<v-spacer></v-spacer <v-spacer></v-spacer
@@ -69,7 +71,7 @@
<!-- TEXT (also maybe openable)--> <!-- TEXT (also maybe openable)-->
<template v-if="c.i"> <template v-if="c.i">
<!-- openable object with an ID --> <!-- openable object with an ID -->
<v-btn depressed small @click="btnClick(c.key, c.i)">{{ <v-btn depressed small @click="gridCellButtonClick(c.key, c.i)">{{
c.v c.v
}}</v-btn> }}</v-btn>
</template> </template>
@@ -214,7 +216,7 @@
<template v-if="c.i"> <template v-if="c.i">
<!-- openable object with an ID --> <!-- openable object with an ID -->
<span <span
@click="btnClick(c.key, c.i)" @click="gridCellButtonClick(c.key, c.i)"
class="primary--text subtitle-1 font-weight-bold" class="primary--text subtitle-1 font-weight-bold"
style="cursor:pointer" style="cursor:pointer"
>{{ c.v }} >{{ c.v }}
@@ -373,7 +375,10 @@ export default {
}); });
}, },
btnClick(key, i) { listViewChanged: function() {
alert("STUB:ListView Changed: " + this.listViewId);
},
gridCellButtonClick(key, i) {
//translate key to actual object type from header data //translate key to actual object type from header data
//key format is row-column e.g."500-2" //key format is row-column e.g."500-2"
//get the datatype of the column which matches the server columns array index //get the datatype of the column which matches the server columns array index
@@ -457,34 +462,23 @@ export default {
//get pick lists //get pick lists
var vm = this; var vm = this;
initForm(vm) initForm(vm).then(() => {
.then(() => { // path: "/ay-data-list-view/:listViewId/:dataListKey",
// path: "/ay-data-list-view/:listViewId/:dataListKey",
//rehydrate last form settings //rehydrate last form settings
var formSettings = window.$gz.form.getFormSettings(this.formKey); var formSettings = window.$gz.form.getFormSettings(this.formKey);
if (formSettings.saved && formSettings.saved.itemsPerPage) { if (formSettings.saved && formSettings.saved.itemsPerPage) {
this.dataTablePagingOptions.itemsPerPage = this.dataTablePagingOptions.itemsPerPage =
formSettings.saved.itemsPerPage; formSettings.saved.itemsPerPage;
} }
if (formSettings.temp && formSettings.temp.page) { if (formSettings.temp && formSettings.temp.page) {
this.dataTablePagingOptions.page = formSettings.temp.page; this.dataTablePagingOptions.page = formSettings.temp.page;
} }
vm.formState.ready = true; // vm.formState.ready = true;
vm.dataListKey = this.$route.params.dataListKey; // vm.dataListKey = this.$route.params.dataListKey;
vm.listViewId = this.$route.params.listViewId; // vm.listViewId = this.$route.params.listViewId;
window.$gz.eventBus.$on("menu-click", clickHandler); });
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
//modify the menu as necessary
generateMenu(this, false); //default is never read only and passing in this vm
//init disable save button so it can be enabled only on edit to show dirty form
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
})
.catch(err => {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
} }
}; };
@@ -644,7 +638,6 @@ async function fetchEnums(columnData) {
} }
} }
///////////////////////////////// /////////////////////////////////
// //
// //

View File

@@ -42,14 +42,14 @@
</v-row> </v-row>
<v-row> <v-row>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<v-select <!-- <v-select
v-model="listViewId" v-model="listViewId"
:items="pickLists.availableDataListViews" :items="pickLists.availableDataListViews"
item-text="name" item-text="name"
item-value="id" item-value="id"
:label="lt('GridFilterName')" :label="lt('GridFilterName')"
@change="filterChanged()" @change="filterChanged()"
></v-select> ></v-select> -->
</v-col> </v-col>
</v-row> </v-row>
</v-form> </v-form>
@@ -336,7 +336,8 @@ function generateMenu(vm) {
// //
// //
function initForm(vm) { function initForm(vm) {
return populatePickLists(vm); return Promise.resolve();
//return populatePickLists(vm);
//If need to call more then...: //If need to call more then...:
// .then(() => { // .then(() => {
// //Must use return here // //Must use return here
@@ -344,22 +345,22 @@ function initForm(vm) {
// }); // });
} }
//////////////////// // ////////////////////
// // //
function populatePickLists(vm) { // function populatePickLists(vm) {
//http://localhost:7575/api/v8/DataListView/PickList?ListKey=TestWidgetDataList // //http://localhost:7575/api/v8/DataListView/PickList?ListKey=TestWidgetDataList
return window.$gz.api // return window.$gz.api
.get("DataListView/PickList?ListKey=" + vm.$route.params.dataListKey) // .get("DataListView/PickList?ListKey=" + vm.$route.params.dataListKey)
.then(res => { // .then(res => {
if (res.error != undefined) { // if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm); // window.$gz.errorHandler.handleFormError(res.error, vm);
} else { // } else {
vm.pickLists.availableDataListViews = res.data; // vm.pickLists.availableDataListViews = res.data;
window.$gz.form.addNoSelectionItem(vm.pickLists.availableDataListViews); // window.$gz.form.addNoSelectionItem(vm.pickLists.availableDataListViews);
//vm.pickLists.availableDataListViews.unshift({ name: "-", id: 0 }); // //vm.pickLists.availableDataListViews.unshift({ name: "-", id: 0 });
} // }
}); // });
} // }
//////////////////// ////////////////////
// //