This commit is contained in:
@@ -278,6 +278,11 @@ TAGS - At server if equality compare value is an array of strings then it's assu
|
||||
|
||||
---------------------- NON DATALISTVIEW STUFF ----------------------------
|
||||
TODO: "Unsaved filter" being displayed, sb "Unsaved listview"
|
||||
|
||||
TODO: No way to make a new widget now!!!
|
||||
TODO: new widget save re-fetches unnecessarily
|
||||
- Instead should just use the data that came back with the save as it has all that's required
|
||||
- should manipulate the history api instead to seem like it never was at zero record ID before save
|
||||
TODO: Switch control has issues in mobile view throws error "touch is undefined"
|
||||
- Update and see if fixes or else switch to some other component
|
||||
TODO: HELP link on listVieweditor not working
|
||||
|
||||
@@ -709,9 +709,27 @@ export default {
|
||||
},
|
||||
submit() {
|
||||
if (this.canSave) {
|
||||
this.formState.loading = true;
|
||||
var vm = this;
|
||||
var url = API_BASE_URL + this.$route.params.id;
|
||||
vm.formState.loading = true;
|
||||
|
||||
var url = API_BASE_URL;
|
||||
|
||||
var lvSave = {
|
||||
id: 0,
|
||||
userId: vm.obj.userId || 1,
|
||||
name: vm.obj.name,
|
||||
public: vm.obj.public,
|
||||
listKey: vm.dataListKey,
|
||||
listView: generateListViewFromEdited(vm)
|
||||
};
|
||||
|
||||
//are we working off a pre-existing listview (save over)?
|
||||
if (vm.listViewId > 0) {
|
||||
lvSave.id = vm.listViewId;
|
||||
lvSave.concurrencyToken = vm.obj.concurrencyToken;
|
||||
url = url + vm.listViewId;
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"id": 0,
|
||||
@@ -735,7 +753,7 @@ export default {
|
||||
//clear any errors vm might be around from previous submit
|
||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
window.$gz.api
|
||||
.upsert(url, this.obj)
|
||||
.upsert(url, lvSave)
|
||||
.then(res => {
|
||||
vm.formState.loading = false;
|
||||
if (res.error != undefined) {
|
||||
@@ -745,7 +763,11 @@ export default {
|
||||
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
|
||||
if (res.data.id) {
|
||||
//Handle "post" of new record (CREATE)
|
||||
vm.obj = res.data;
|
||||
|
||||
//FOr listview this is the big one to handle as it's so funky
|
||||
//NOPE vm.obj = res.data;
|
||||
|
||||
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
@@ -754,7 +776,14 @@ export default {
|
||||
|
||||
//change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero:
|
||||
vm.$router.replace(
|
||||
vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||
|
||||
//NOPE: vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||
//this is the format for listview:
|
||||
//ay-data-list-view/-1/TestWidgetDataList/test-widgets
|
||||
//or 0 if it's coming from the default listview
|
||||
//or id number if it's got one which we don't care about here
|
||||
//so mission is to replace the 0 or -1 with the real id in the url
|
||||
|
||||
);
|
||||
} else {
|
||||
//Handle "put" of an existing record (UPDATE)
|
||||
|
||||
@@ -507,7 +507,7 @@ export default {
|
||||
readOnly: res.readOnly ? true : false
|
||||
});
|
||||
|
||||
//change url to new record but don't actually navigate, replace current url with same url but with the actual id at the end instead of zero:
|
||||
//change url to new record in history and actually navigate but with the actual id at the end instead of zero:
|
||||
vm.$router.replace(
|
||||
vm.$route.fullPath.slice(0, -1) + res.data.id
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user