This commit is contained in:
2020-02-18 18:53:27 +00:00
parent 2e9431112a
commit 8333f6aed9
2 changed files with 30 additions and 32 deletions

View File

@@ -45,39 +45,34 @@ CURRENT TODOs
TODO: FILTER AT CLIENT
PICKLIST
- Picklists have all teh same requirements except they are used all over and replicated on many forms so they will have their own store considerations when the time comes
DataTable host FORM:
- Allows selection of listView, has button to go edit the listview
DataTable control:
- accepts formkey and DataListKey
- Checks for source of ListView JSON and uses it if present
- If ID and cached copy of JSON in form settings temp storage then uses cached copy
- If ID but no cached copy fetches and stores in form settings temp storeage cache and uses
- If saved JSON but no id then just uses directly
ListViewEditor
- Needs to know what formsettings key is in use to check with PUT ON ROUTE
- Needs to know which DataList key to work with PUT ON ROUTE
- Edit list view, can also duplicate to create fresh one
- gets listviewid and datalistkey on route
- INIT
- First GET DataListFields for the DataListKey from DataList ListFields route (query string DataListKey value supplied )
- This is the pool of available fields
- Second get the ListView that is currently in use so can setup the page view
- If listviewid is zero then that's starting with the default list view so need to fetch it and then init the form
- If listviewid is -1 then that's staring with an unsaved listview so get that from the saved form store
- If listviewid is greater than 0 then it's a saved listview and there sb a cached version of it but ideally maybe fetch it from
- Third: Make up the working copy array that the UI is tied to
- Fourth: when the working copy array changes that should trigger the UI to draw accordingly
- Editing
- any changes to UI objects affects working copy
- Also the cached listview stuff needs to be changed so if user leaves form and goes back the changes are immediately seen in the datatable
- Put unsaved listview into formsettings and set id to -1
- Saving
- process working copy to generate a ListView suitable to save and save it
- On save set formsettings listviewid to whatever the id is and put listview into temp cache and clear out unsaved listview
- duplicate
- Make a listview and save under new duplicate name or however Widget was coded (makes a default then user changes name I guess)
- set formsettings listviewid to duplicates new id and clear out formsettings unsaved listview and put formsettings listivew into cache
- delete
- Remove listview from server, fixup local formsetting to use default listview and id 0
DataTable form ListView picker
- when open form check store for formsettings for this form:
- If store SAVED formkey settings has listview ID then selects that item from listview picklist on form
- If store SAVED FORMKEY has no listview id and has JSON listView then then says -1 value and displays "Unsaved ListView" (User has to open listview editor to save it)
- If store SAVED FORMKEY has no listivew Id and no JSON listView then selects 0 and shows "-" meaning no selection
- On change:
- If a selection is made and there is an unsaved filter the unsaved gets obliterated and selection changes
- ListView picker has unsaved item removed from it's list
- when selection changes to a saved id item
- gzform formsettings saved ListView id is set to value selected
- gzform formsettings saved EditedListViewJson is set to empty / undefined
- When selection changes to the empty "-" default no selection
- formsettings ListViewId is set to 0
- EditedListViewJson is set undefined empty
- Tells gz-data-table control it should update itself
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]}

View File

@@ -102,6 +102,10 @@ export default {
},
created() {
var vm = this;
//set route values in data object so init form can handle
vm.dataListKey = this.$route.params.dataListKey;
vm.listViewId = this.$route.params.listViewId;
// //rehydrate last form settings
// var formSettings = window.$gz.form.getFormSettings(this.formKey);
@@ -116,8 +120,7 @@ export default {
.then(() => {
// path: "/ay-data-list-view/:listViewId/:dataListKey",
vm.formState.ready = true;
vm.dataListKey = this.$route.params.dataListKey;
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