首次ng-grid显示我的数据非常好,但是当用户更改输入表单然后应用程序通过ajax调用获取新数据时,ng-grid数据不会更新。
$scope.gridOptions = {
data: 'gridData',
plugins: [new ngGridCsvExportPlugin()],
showFooter: true
};
$scope.gridData = [];
$http({
method: 'POST',
url: '/risk',
data: criteria,
headers: {
'Content-Type': 'application/json'
}
}).success(function (response) {
var gridData = [];
response.list.forEach(function (e, i) {
if (criteria.measureType == 'risk')
gridData.push({'risk': e.riskFactor, "bank": e.bank});
else if (criteria.measureType == 'centrality')
gridData.push({"centrality": e.centrality, "bank": e.bank});
});
}
$scope.gridData = angular.copy(gridData);
$scope.$apply()
});
neigher ng-grid doesn't update data或AngularJS/ng-grid - Updating array with splice doesn't updates UI无法提供任何帮助。 我的错是什么tanhks
答案 0 :(得分:0)
我和Ui网格有类似的问题。我们在更改或想要刷新数据时使用广播来更新网格数据