I'm trying to implement a custom property editor in Umbraco 8. I know that the video on Umbraco.tv is outdated, but I still followed the instructions in
When I try to use this data type in the Umbraco backoffice, I get a Javascript error:
Cannot create property 'val1' on string ''
Does anyone know what changed in Umbraco v8 compared to v7 regarding custom property editors? Since the documentation is also not yet updated, I have no idea what's wrong here.
According to this post JSON is saved as ntext in the database. It might be because a string is the default value for that datatype. Im not sure if its an new issue in v8.
What you can do as a fix is putting this in the controller for your property editor:
var initModelValue = $scope.$watch('model.value', function (model) {
if (typeof model === 'string' && model.length == 0)
$scope.model.value = {};
initModelValue(); //Deregisters the watch so we wont waste resources
});
Custom Property Editor with valueType JSON
Hi there,
I'm trying to implement a custom property editor in Umbraco 8. I know that the video on Umbraco.tv is outdated, but I still followed the instructions in
https://umbraco.tv/videos/umbraco-v7/developer/extending/property-editors/storing-complex-data/
and created my package manifest where I declared the valueType as JSON:
In the view I try to bind two inputs to their corresponding properties (ng-model="model.value.val1" and ng-model="model.value.val2"):
When I try to use this data type in the Umbraco backoffice, I get a Javascript error:
Does anyone know what changed in Umbraco v8 compared to v7 regarding custom property editors? Since the documentation is also not yet updated, I have no idea what's wrong here.
Thanks in advance for any help you can provide!
Cheers, David
Nobody has any idea why this is?
According to this post JSON is saved as ntext in the database. It might be because a string is the default value for that datatype. Im not sure if its an new issue in v8.
What you can do as a fix is putting this in the controller for your property editor:
Cool, thanks! That works flawlessly!
is working on a reply...