I have a Kendo UI Grid with angular js: I have data in the grid and when I click a button, I want to reload the data in the grid with newly updated data.
So, in the angular controller I have:
var dataSource = new kendo.data.DataSource({
transport: {
read: function (e) {
cache: false;
e.success($scope.gridData);
}
},
aggregate: [
{ field: "TOTAL", aggregate: "sum" }
],
pageSize: 14,
schema: {
model: {
id: "id",
fields: {
name: { editable: false, nullable: true },
TOTAL: { editable: false, nullable: true }
}
}
},
});
When I click the button, the below code I have:
$scope.CalculateData = function (e) {
service.Data($scope.gridData)
.then(function (response) {
if (response.statusText == "OK") {
$scope.gridData = [];
$scope.gridData = response.data;
dataSource.read();
}
},
function (response) {
alert("Error");
}
);
}
Even I am calling dataSource.read(); still, the grid data is not reloading with new data.
How can I resolve this problem?