I have data in the grid but after certain actions like (delete or add) i want to refresh grid , below i have method for delete that is deleting the row in Kendo grid. So i want to refresh grid once delete action is completed. How to achieve that task with below implementation...
So far tried code....
main.html
<div kendo-grid="topRiskGrid" options="topRisksOptions" ></div>
main.ctrl
$scope.topRisksOptions = topRiskGridConfig.getTopRisksGrid();
$scope.topRisksOptions.dataSource = rcsaAssessmentService.getTopRisksGridDataSource($stateParams.assessmentId);
var deleteCallBack = function () {
$scope.topRiskGrid.dataSource.read();
};
$scope.deleteTopRisks = function(key){
rcsaAssessmentFactory.deleteTopRisk(key.riskAssessmentKeyConcernKey,'RS_DELETED').then(function(){
deleteCallBack();
});
}
main.factory
getTopRisksGridDataSource : function(assessmentId) {
return new kendo.data.DataSource({
type : 'json',
transport : {
read : function(options) {
return $http.get('app/assessment/rest/topRisks?riskAssessmentKey=' +assessmentId).success(
function(data) {
options.success(data.riskAssessmentKeyConcernDTOs);
});
}
},
pageSize : 5,
});
}
rcsaAssessmentFactory.deleteTopRisk()? Doing a read on the server without deleting the data there will just repopulate it like nothing happened. - Brett