From 326c434098efba6f089b4bd9f2423f06db854631 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 24 Feb 2020 20:45:18 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 7 +++-- ayanova/src/views/ay-data-list-view.vue | 37 +++++++++++-------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index b6ad1029..10a7b03f 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -280,9 +280,10 @@ TAGS - At server if equality compare value is an array of strings then it's assu 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: save (post) of new record at client triggers renavigation to that page again which also triggers fetch + - So what's the point of returning the full record on post? + - Might as well return nothing if the save was successful other than the new ID + - On the other hand, is the data still kept in the view or is create called again fresh and all that?? 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 diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index 3a31bca2..f5d5aaa4 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -764,27 +764,22 @@ export default { if (res.data.id) { //Handle "post" of new record (CREATE) - //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, - 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: - vm.$router.replace( - - //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 - - ); + //change url to new record + //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 + var urlParts = vm.$route.split("/"); + var newUrl = + urlParts[0] + + "/" + + res.data.id + + "/" + + urlParts[2] + + "/" + + urlParts[3]; + vm.$router.replace(newUrl); } else { //Handle "put" of an existing record (UPDATE) vm.obj.concurrencyToken = res.data.concurrencyToken;