I am using Umbraco and is working with the data-type grid layout and want to add custom settings (css classes) to each row/cell and it kinda work. User interface:
The "modifier": "{X}" give different results the 3 worked "best".
And the json:
[
{
"label": "Message Box",
"description": "Message Box",
"key": "class",
"view": "checkbox",
"modifier": "{3}",
"applyTo": "cell",
"config": {
"items": {
"key1": {
"value": "value1"
},
"key2": {
"value": "value2"
},
"key3": {
"value": "value3"
},
"key4": {
"value": "value4"
}
}
}
}
]
But the cell/rows that i apply these classes to end up looking like this
<div class="["key1", "key2", "key3", "key4"]">
And the html cant understand these classes when they have [] and commas after how can i make so the classes is applied propperly to the elements?
Pastebin of the modified Foundation5
Pastebin of Umbracos checkbox code
Change this:
$scope.$watch('selectedItems', function (newVal, oldVal) {
$scope.model.value = [];
for (var x = 0; x < $scope.selectedItems.length; x++) {
if ($scope.selectedItems[x].checked) {
$scope.model.value.push($scope.selectedItems[x].key);
}
}
}, true);
Into this:
$scope.$watch('selectedItems', function (newVal, oldVal) {
var classList = [];
for (var x = 0; x < $scope.selectedItems.length; x++) {
if ($scope.selectedItems[x].checked) {
classList.push($scope.selectedItems[x].key);
}
}
$scope.model.value = classList.join(' '); // imploding class list
}, true);
Instead of adding the whole array with the class list to your front end, you should implode your array and split the individual classes by a whitespace.