是否有可能有一个选择下拉AngularJS NG-网格内? [英] Is it possible to have a select drop down inside of the AngularJS ng-grid?
问题描述
我有codeD以下内容:
I have coded the following:
$scope.gridOptions = {
data: 'myData',
enableCellEdit: true,
multiSelect: false,
columnDefs: [
{ field: 'Id', displayName: 'Id' },
{ field: 'Name', displayName: 'Name', enableCellEdit: true, editableCellTemplate: cellEditableTemplate },
{ field: 'Description', displayName: 'Description', enableCellEdit: true, editableCellTemplate: cellEditableTemplate }
]
};
该myData的其实包含四个colums编号,名称,状态和说明。其中,状态是三种状态称为myStatus一个简单的JavaScript数组。
The myData actually contains four colums Id, Name, Status and Description. Where status is a simple javascript array with three types of status called myStatus.
是否有可能对我来说,从myStatus数据以某种方式链接到现场的NG-格,所以我可以再选择从选择下拉一个新的价值?
Is it possible for me to somehow link in the data from myStatus to a field in the ng-grid so I can then select a new value from a select drop down?
推荐答案
下面是一些实验的输出。
Here is output of some experiment.
<一个href=\"http://plnkr.co/edit/W1TkRgsp0klhqquxaiyc?p=$p$pview\">http://plnkr.co/edit/W1TkRgsp0klhqquxaiyc?p=$p$pview
看来你可以把在电池模板选择
。
你可以使用行
对象检索任何
你需要。
我用 row.rowIndex
财产访问原始数据。
It seems that you can put select
in cell template.
And you can make use of row
object to retrieve whatever
you need.
I used row.rowIndex
to property access to the original data.
模板,例如:
<div>
<select ng-model="myData[ row.rowIndex ].myStatus">
<option ng-repeat="st in statuses">{{st}}</option>
</select>
</div>
(这将是美丽的温馨如果我们可以通过连续写入数据ogirinal
目的。我不知道怎么办。)
(It would be beutiful if we can write to ogirinal data through row
object. I do not know how.)
这篇关于是否有可能有一个选择下拉AngularJS NG-网格内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!