我正在研究ui网格编辑单元格功能.我需要使用rest api将编辑的单元格值更新到数据库.另外,我如何获得在控制器中选择的行列表.
我的工作代码
var app = angular.module('app', ['ngTouch', 'ui.grid', 'ui.grid.edit']);
app.controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {
$scope.gridOptions = { };
$scope.gridOptions.columnDefs = [
{ name: 'id', enableCellEdit: false},
{ name: 'name' },
{ name: 'age', displayName: 'Age' , type: 'number', width: '10%' }
];
$http.get('https://cdn.rawgit.com/angular-ui/ui-grid.info/gh-pages/data/500_complex.json')
.success(function(data) {
$scope.gridOptions.data = data;
});
}])
Run Code Online (Sandbox Code Playgroud)
基于此帮助链接,我能够实现颜色更改,但在此解决方案中,它将颜色应用于整行,这不是我正在寻找的.
我想更改唯一编辑过的单元格的颜色.如果有人有任何想法,请分享.谢谢.