After fetching data for my Kendo grid from the backend and populating it in the
alignedProcessesToRiskGridOptions
, I noticed that while the data is displayed in the grid, I also need access to the raw data for additional logic. Is there a way to retrieve data from the dataSource or directly call the RiskService
AngularJs factory to assign it to a variable like gridData
?
ctrl.js
$scope.alignedProcessesToRiskGridOptions = RiskService.alignedProcessToRiskGrid();
$scope.alignedProcessesToRiskGridOptions.dataSource = RiskService.getAlignedProcessesToRiskGridDataSource($stateParams.riskId);
gridData = $scope.alignedProcessesToRiskGridOptions.dataSource.data();
console.log('RISK DATA', gridData);
factory.js
getAlignedProcessesToRiskGridDataSource: function(riskKey) {
var countNew = 0;
return new kendo.data.DataSource({
type: 'json',
serverPaging: true,
serverSorting: true,
serverFiltering: true,
transport: {
read: function(options) {
var gridSearchObject = {
skip: options.data.skip,
take: options.data.take,
pageSize: options.data.pageSize,
page: options.data.page,
sorting: options.data.sort,
filter: options.data.filter
};
return $http.post(
'app/risk/rest/allAlignedProcessesToRisk/' + riskKey, gridSearchObject).success(
function(data) {
countNew = data.totalCount;
options.success(data.resultDTOList);
});
}
},