Angular ui-grid: bootstrap dropdown in cell

荒凉一梦 提交于 2020-02-04 03:40:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!