I have output variable called restResponse(it’s an array of json objects) which i got from previous scriptTask processors after that i want to use it’s data inside my embedded html form for this reason i use code like this
var restResponse=$scope.restResponse[];
$scope.details = function(){
var newDataList=[];
$scope.selectedAll = false;
angular.forEach($scope.restResponse, function(selected){
if(!selected.selected){
newDataList.push(selected);
}
});
$scope.dataDocument = newDataList;
};
$scope.checkAll = function () {
if (!$scope.selectedAll) {
$scope.selectedAll = true;
} else {
$scope.selectedAll = false;
}
angular.forEach($scope.restResponse, function (restResponse) {
restResponse.selected = $scope.selectedAll;
});
};
}]);
}
camForm.on('store', function() {
camForm.variableManager.variableValue('restResponse', $scope.restResponse);
});
camForm.on('form-loaded', function() {
camForm.variableManager.fetchVariable('restResponse');
});
// variables-fetched is not working with "saved" forms, so we need to use variables-restored, which gets called after variables-fetched
camForm.on('variables-restored', function() {
$scope.restResponse = camForm.variableManager.variableValue('restResponse');
});
</script>
<div class="contrinaer">
<div class="row" >
<div class="col-md-12">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th><input type="checkbox" ng-model="selectedAll" ng-click="checkAll()" /></th>
<th>id</th>
<th>Type</th>
<th>Organization</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="doc in restResponse">
<td><input type="checkbox" ng-model="doc.selected"/></td>
<td><input type="number" ng-model="doc.id"/></td>
<td><input type="text" ng-model="doc.organizationNameGE"/></td>
<td><input type="button" class="btn btn-success pull-right" ng-click="details()" value="Details"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>
i can’t get any exception but my table is empty see this picture
what should i change to make my code work?