DropDown不在UI网格角度js中渲染

时间:2015-05-22 08:42:35

标签: angularjs

我的观点有以下代码部分,但当用户点击单元格编辑选项是可用的但是在文本框而不是下拉列表中:

 <div id="grdAreaDetails" ui-grid="gridOptions" class="grid" ui-grid-edit ui-grid-row-edit></div>

控制器位于

之下
 $scope.cellSelectEditableTemplate = '<select  ng-model="COL_FIELD" ><option value="volvo">Volvo</option><option value="saab">Saab</option></select>';

$scope.maxLength = 200;
$scope.sites = [];
$scope.showloadingdiv = true;
$scope.isAreaAddPanelHide = false;

$scope.gridOptions = {};

$scope.gridOptions.columnDefs = [                 
{
    name: 'code', field: 'code', enableCellEditOnFocus: true,
    editableCellTemplate: $scope.cellSelectEditableTemplate
},
{ name: 'name',field:'name'},
{ name: 'notes',field:'notes'},
{ name: 'description', field: 'description' },
 { name: 'siteid', field: 'siteid' },
{ name: 'status',field:'status' }
];

$scope.gridOptions = {      
    data: $scope.AreaRecord,
    multiSelect: false,
    onRegisterApi: function (gridApi) {
        $scope.gridApi = gridApi;
        gridApi.rowEdit.on.saveRow($scope, $scope.UpdateArea);
    }
}

1 个答案:

答案 0 :(得分:0)

只需删除enableCellEditOnFocus:true并添加“enableCellSelection:true” 让我知道会发生什么。

$scope.gridOptions.columnDefs = [                 
 {
   name: 'code', field: 'code' , enableCellSelection: true,
   editableCellTemplate: $scope.cellSelectEditableTemplate
 },
 { name: 'name',field:'name'},
 { name: 'notes',field:'notes'},
 { name: 'description', field: 'description' },
 { name: 'siteid', field: 'siteid' },
 { name: 'status',field:'status' }
];

如果这不起作用,那就小提琴。