diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue index 4b6d3f46..e0a21b22 100644 --- a/ayanova/src/components/custom-fields-control.vue +++ b/ayanova/src/components/custom-fields-control.vue @@ -143,12 +143,41 @@ export default { return null; } // debugger; + //get the data out of the JSON string value var cData = JSON.parse(this.value); + + //get the type it *should* be + //TODO: method here + + //coerce it to that type and return it + //TODO: Method here + // debugger; return cData[dataKey]; }, SetValueForField: function(dataKey, newValue) { - console.log("Setting " + dataKey + " TO " + newValue); + //console.log("Setting " + dataKey + " TO " + newValue); + + //Get the data out of the json string value + // + var cData = JSON.parse(this.value); + + //then set item in the cData + //initial naive attempt: (tostring is suspect) + cData[dataKey]=newValue.toString(); + + //TODO: look at how the datetime and tags use the value vs a local cached value instead of mutating the props value + //to json text (opposite of Parse above) + //BUGBUG: + /* + //DEV ERROR errorHandler::devShowUnknownError - unexpected error: + +Vue warning: +Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "value" + +//MAYBE I need to modify the value object, not simply replace it (somehow?) + */ + this.value=JSON.stringify(cData) } }, beforeCreate() { @@ -160,17 +189,7 @@ export default { if (!this.$gzlocale) { throw "custom-fields-control: $gzlocale is required and missing"; } - } - //debugger; - // this.$set(this.obj, "c1", "2020-03-12T16:37:39.9094856Z"); - // this.$set( - // this.obj, - // "c2", - // "Sint laborum quisquam dolorem ipsum architecto voluptate consequatur tempora praesentium. Nemo aliquam amet aut aliquid perspiciatis adipisci excepturi. Officia ea voluptatem dolore suscipit ipsa itaque. Quaerat nostrum ut qui dignissimos nesciunt quasi laudantium dicta. Ut nihil doloribus illum rem quas sed." - // ); - // this.$set(this.obj, "c3", 30453626); - // this.$set(this.obj, "c4", false); - // this.$set(this.obj, "c5", 5.55); + } }, created() { if (this.$gzdevmode()) { @@ -178,19 +197,8 @@ export default { if (!this.formKey) { throw "custom-fields-control: formKey property is required and missing"; } - } - //{"c1":"2020-03-12T16:37:39.9094856Z","c2":"Sint laborum quisquam dolorem ipsum architecto voluptate consequatur tempora praesentium. Nemo aliquam amet aut aliquid perspiciatis adipisci excepturi. Officia ea voluptatem dolore suscipit ipsa itaque. Quaerat nostrum ut qui dignissimos nesciunt quasi laudantium dicta. Ut nihil doloribus illum rem quas sed.", - //"c3":30453626,"c4":false,"c5":0.529134196010015} + } } }; -// ////////////////////// -// // Get the data for the specified field key from the custom fields object -// // coerce the type if necessary / handle incompatible types -// function GetDataForField(fldKey, vm) { -// debugger; -// var cData = JSON.parse(vm.value); -// debugger; -// return "BaLH"; -// }