【发布时间】:2016-10-23 15:35:09
【问题描述】:
我使用 ui-grid v3.2.9。我有带有内联编辑的网格,这是编辑单元格之一 - 下拉控件。每次单击此单元格时,我都想获取用于下拉控件的数组。我尝试使用 editDropdownOptionsFunction 下载 json 以进行下拉:
columnDefs: [
{
name: 'serial',
displayName: 'Serial',
width: 100,
enableCellEdit: true,
editableCellTemplate: 'ui-grid/dropdownEditor',
editDropdownIdLabel: 'id',
editDropdownValueLabel: 'id',
editDropdownOptionsFunction: function(rowEntity, colDef){
var res = [];
$http.get('index.php?r=docs/serialsjson2&recid=' + rowEntity.id)
.success(function (data) {
res = data;
});
return res;
}
},
],
但据我了解,$http.get 完成得太晚了,并且没有填充 dropdownarray。 请帮帮我。我需要如何在点击时从服务器向下拉小部件请求数据?
【问题讨论】:
标签: javascript angularjs dropdown ui-grid