问题
I have an agular ui-grid and dropdowns in its cells. Why my dropdown doesn't show on click?
var columnDefs1 = [
{ name: 'firstName'},
{ name: 'lastName'},
{ name: 'company'},
{ name: 'employed'},
{ name: '#',
cellTemplate:
'<div class="dropdown">' +
'<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">' +
'Dropdown' +
'<span class="caret"></span>' +
'</button>' +
'<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">' +
'<li><a href="#">Action</a></li>' +
'<li><a href="#">Another action</a></li>' +
'<li><a href="#">Something else here</a></li>' +
'<li role="separator" class="divider"></li>' +
'<li><a href="#">Separated link</a></li>' +
'</ul>' +
'</div>'
}
];
http://plnkr.co/edit/4Hnmxl?p=preview
回答1:
full description from ui grid developer http://brianhann.com/ui-grid-and-dropdowns/
u should describe needed columns as required
columnDefs: [
{ name: 'name' },
{ name: 'age', type: 'number' },
{
name: 'gender',
editableCellTemplate: 'uiSelect',
editDropdownOptionsArray: [
'male',
'female',
'other'
]
}
]
and here is a working sample : http://plnkr.co/edit/ckQhv5bWha2jte5wDBI1?p=preview
来源:https://stackoverflow.com/questions/36833168/angular-ui-grid-bootstrap-dropdown-in-cell