Karl Tynan
Karl Tynan

Reputation: 125

Multiple values for custom Umbraco datatype in U7

I want multiple rows of values (more than 1 input) for a custom datatype in Umbraco 7.

Currently, multiple rows and data are being added when saved, but after adding 5 rows I get the following error when saving:

Received an error from the server: 
String or binary data would be truncated. The statement has been terminated.
...

I have set the manifest to expect JSON data (however it was previously undefined).

Does anybody know what I have done wrong or how to save large amounts of data for a custom Umbraco 7 datatype?

Manifest

{
  propertyEditors: [
    {
      alias: "Test",
      name: "Test",
      editor: {
        view: "~/App_Plugins/Test/test.html",
        hideLabel: false,
        valueType: "JSON"   
      }
    }
  ],
  javascript: [
    "~/App_Plugins/Test/test.controller.js"
  ] 
}

View

...
<tbody>
  <tr ng-repeat="value in model.value.list">
    <th>{{value.name}}</th>
    <td>{{value.size}}</td>
    <td>{{value.weight}}</td>
  </tr>
</tbody>
<tfoot>
  <tr>
    <th><input type="text" ng-model="addRowName" /></th>
    <td><input type="text" ng-model="addRowSize" /></td>
    <td>
      <input type="text" ng-model="addRowWeight" />
      <a ng-click="addRow()" href="">Add Row</a>
    </td>
  </tr>
</tfoot>
...

JS/Controller (addRow function)

...
$scope.addRow = function() {
  $scope.model.value.list.push({
    name: $scope.addRowName,
    size: $scope.addRowSize,
    weight: $scope.addRowWeight
  });
};
...

Upvotes: 0

Views: 1614

Answers (1)

Related Questions