关键代码:
如果数据源是本地数据
$("#hidJsonData").val("[]");
var myJsonData = [];
if ($("#hidJsonData").val() != "") {
myJsonData = JSON.parse($("#hidJsonData").val());
}
$scope.myData = myJsonData ;//本地数据
$scope.gridOptionsUserRole.totalItems = myJsonData.length;
$scope.gridOptionsUserRole.data = myJsonData;
如果数据源是url的 可以重新调用getPage
getPage($scope.gridOptions.paginationCurrentPage, $scope.gridOptions.paginationPageSize);
//getPageChooseRole($scope.gridOptionsUserRole.paginationCurrentPage, $scope.gridOptionsUserRole.paginationPageSize);
全部取消选中
$scope.gridApi.selection.clearSelectedRows();
获取grid现有数据源,对其进行编辑后,进行刷新
$scope.refreshCheckedAccount = function () {
//$scope.gridOptionsReportAccount.totalItems = data.total;
var oldData = $scope.gridOptionsReportAccount.data ;
for(var i = 0;i<oldData.length;i++){
if (i < 5) {
oldData[i].checkedInd = true;
oldData[i].accountCode = "123";
}
}
$scope.gridOptionsReportAccount.data = oldData;
$interval(function() {
$scope.gridApi.core.refresh();
}, 300, 2);
}