是否可以将ng-grid细胞的可编辑模式限制为仅在一列中的细胞?
我目前使用 enableCellEditOnFocus:true ,此全局允许所有单元格可编辑。我确实有一个特定的editableCellTemplate用于一列,我希望所有其他列“readonly” 。
有关初学者使用angularjs和ng-grid制作他的第一个婴儿步骤的任何建议吗?
这是当前网格的相关设置:
var app = angular.module('myCoolGridApp', ['ngGrid']);
app.controller('MyCtrl', function ($scope, $http) {
$scope.gridOptions = {
data: 'myData',
enableCellSelection: true,
enableRowSelection: false,
enableCellEditOnFocus: true,
jqueryUITheme: true,
columnDefs: 'colDefs'
};
var myCellEditableTemplate = "<input ng-class=\"'colt' + col.index\" ng-input=\"COL_FIELD\" ng-model=\"COL_FIELD\" ng-blur=\"updateEntity(col, row)\"/>";
$scope.colDefs = [
{field: 'group'},
{field: 'user'},
{field: 'id', displayName: 'ID', editableCellTemplate: myCellEditableTemplate},
{field: 'last_login_date'},
{field: 'status'}
];
$scope.updateEntity = function (column, row) {
// code for saving data to the server next...
}
});