This commit is contained in:
@@ -105,7 +105,7 @@ ListViewEditor
|
||||
|
||||
GZFORM FORMSETTINGS RELATED TO DATALISTVIEW
|
||||
- formSettings.saved.dataTable.{listViewId:[0 if none or else the last saved view id selected], unsavedListView:[edited but unsaved listview json, only if listviewId=0]}
|
||||
- formSettings.temp.dataTable.cachedListView - temporary cached version of listview that was saved at server but only if saved listviewId is non-zero
|
||||
- formSettings.temp.cachedListView - temporary cached version of listview that was saved at server but only if saved listviewId is non-zero
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ pickLists.listViews }}
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-select
|
||||
@@ -379,14 +380,23 @@ export default {
|
||||
},
|
||||
|
||||
listViewChanged: function() {
|
||||
//console.log("listViewchanged: TOP");
|
||||
var vm = this;
|
||||
console.log("listViewchanged: TOP b4 remove unsaved");
|
||||
console.log(vm.pickLists.listViews);
|
||||
//If listview had changed it can only have changed *away* from the unsaved filter item if it's present so just remove that if it exists
|
||||
window.$gz._.remove(vm.pickLists.listViews, function(n) {
|
||||
return n.id == -1;
|
||||
});
|
||||
|
||||
if (vm.listViewId == -1) {
|
||||
vm.listViewId = 0;
|
||||
}
|
||||
//
|
||||
console.log(vm.pickLists.listViews);
|
||||
console.log(vm.listViewId);
|
||||
|
||||
var ShouldGetData = vm.dataTablePagingOptions.page == 1;
|
||||
// vm.pickLists.listViews
|
||||
|
||||
if (vm.listViewId == 0) {
|
||||
//default view, no saved, no cached
|
||||
vm.listView = undefined;
|
||||
@@ -502,7 +512,7 @@ export default {
|
||||
//rehydrate last form settings
|
||||
//loadFormSettings(vm);
|
||||
vm.loading = false;
|
||||
vm.getDataFromApi(vm);
|
||||
vm.getDataFromApi();
|
||||
|
||||
//vm.getDataFromApi();
|
||||
});
|
||||
@@ -769,6 +779,7 @@ function saveFormSettings(vm) {
|
||||
//
|
||||
function loadFormSettings(vm) {
|
||||
//console.log("loadFormSettings::TOP");
|
||||
// debugger;
|
||||
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||
//process SAVED formsettings
|
||||
if (formSettings.saved) {
|
||||
@@ -813,11 +824,8 @@ function loadFormSettings(vm) {
|
||||
//check for cached local copy of saved list view in use
|
||||
if (vm.listViewId > 0) {
|
||||
//0=no list view, -1=unsaved list view so any number greater than zero means there sb a cached local copy of a saved list view
|
||||
if (
|
||||
formSettings.temp.dataTable &&
|
||||
formSettings.temp.dataTable.cachedListView != null
|
||||
) {
|
||||
vm.listView = formSettings.temp.dataTable.cachedListView;
|
||||
if (formSettings.temp && formSettings.temp.cachedListView != null) {
|
||||
vm.listView = formSettings.temp.cachedListView;
|
||||
} else {
|
||||
//fetch it and cache it
|
||||
return fetchListView(vm, vm.listViewId);
|
||||
|
||||
@@ -444,6 +444,7 @@ export default {
|
||||
generateListViewFromEdited(vm)
|
||||
);
|
||||
formSettings.saved.dataTable.listViewId = -1;
|
||||
formSettings.temp.cachedListView = null;
|
||||
window.$gz.form.setFormSettings(vm.formKey, formSettings);
|
||||
next();
|
||||
} else {
|
||||
@@ -703,6 +704,13 @@ export default {
|
||||
form() {
|
||||
return window.$gz.form;
|
||||
},
|
||||
// setAsUnsavedListView() {
|
||||
// //switch to unsaved listview if not already
|
||||
// if (this.listViewId != -1) {
|
||||
// this.listViewId = -1;
|
||||
// vm.obj.name = vm.lt("FilterUnsaved");
|
||||
// }
|
||||
// },
|
||||
onChange(ref) {
|
||||
if (!this.formState.loading && !this.formState.readOnly) {
|
||||
window.$gz.form.onChange(this, ref);
|
||||
|
||||
Reference in New Issue
Block a user