是否有可能限制使小区选择一列NG-网格? [英] Is it possible to limit ng-grids enabled Cell Selection to one column?
问题描述
是否有可能NG-网格细胞的编辑手法限制细胞只有一个列?结果
我目前使用 enableCellEditOnFocus:真正的这的全局允许所有细胞可编辑的。我有一个特定的editableCellTemplate为一列,通过的我想有所有其他列只读 的。结果
对于初学者做他的第一个孩子,步骤,angularjs和NG网有什么建议?
这是网格的相关设置当前:
VAR应用= angular.module('myCoolGridApp',['ngGrid']);
app.controller('MyCtrl',函数($范围,$ HTTP){ $ scope.gridOptions = {
数据:myData的,
enableCellSelection:真实,
enableRowSelection:假的,
enableCellEditOnFocus:真实,
jqueryUITheme:真实,
columnDefs:colDefs
}; VAR myCellEditableTemplate =<输入纳克级= \\'小马'+ col.index \\NG-输入= \\COL_FIELD \\NG模型= \\COL_FIELD \\NG模糊= \\updateEntity(COL,行)\\/>中; $ scope.colDefs = [
{场:'群'},
{场:用户},
{场:'ID',显示名:'ID',editableCellTemplate:myCellEditableTemplate},
{场:last_login_date},
{场:'状态'}
]; $ scope.updateEntity =功能(列,行){
// code保存数据到服务器的下一个...
}
});
是的,根据的这个文档您可以使用 enableCellEdit
列定义属性设置只列了编辑。您可能需要禁用此属性为你列的其余部分。
Is it possible to limit the editable modus of ng-grids cells to cells in one column only?
I currently use enableCellEditOnFocus: true and this globally allows all cells to be editable. I do have a specific editableCellTemplate for one column, by I would like to have all other columns "readonly".
Any suggestions for a beginner making his first baby-steps with angularjs and ng-grid?
This is the relevant setup of the grid currently:
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...
}
});
Yes, according to this documentation you can use the enableCellEdit
column definition property to set only that column up for editing. You may have to disable this property for the rest of your columns.
这篇关于是否有可能限制使小区选择一列NG-网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!