Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tyler Brown 62 posts 209 karma points
    Nov 17, 2017 @ 15:29
    Tyler Brown
    0

    Using JSON BLOB in string property

    I'm using UI-O-Matic and I would like to save json in one of my custom table properties. I created a Custom Property View:

    <ul ui-sortable="sortableOptions" ng-model="property.value" class="textstring-row-set">
            <li ng-repeat="command in property.value" class="textstring-row-field">
                <input class="umbEditorTextField" type="text" ng-model="command.key" />
                <input class="umbEditorTextField" type="text" ng-model="command.value" />
                <input class="umbEditorTextField" type="text" ng-model="command.description" />
                <i class="icon icon-add" ng-click="addListItem($index)"></i>
                <i class="icon icon-delete" ng-click="removeListItem($index)"></i>
                <i class="icon icon-navigation handle"></i>
            </li>
        </ul>
    

    And in my controller, I want $scope.property.value to be this json format:

    '[{ "key": "command one", "value": "value one", "description": "description one" }]'
    

    The view works fine, but when I try to save the page on create, I get an 'Unexpected character encountered' from Newtonsoft.Json.JsonTextReader.

    Is this not the correct way to store JSON in my property with UI-O-Matic? Or do I need to extend it to take JSON as a property value?

  • Tyler Brown 62 posts 209 karma points
    Nov 20, 2017 @ 16:18
    Tyler Brown
    100

    ok I think found my problem. After searching the field editor views in UIOMATIC, I found $scope.valuesloaded, which I must call to make sure $scope.property.value has been populated when I try to use it!

Please Sign in or register to post replies

Write your reply to:

Draft