在UI网格中,如何在单个单元格中添加两个按钮

时间:2017-01-25 14:23:14

标签: angularjs angular-ui-grid

嗨我需要在一个列中添加两个按钮。如何使用UI-Grid(AngularJS)进行操作。

提前致谢:)

1 个答案:

答案 0 :(得分:2)

您可以在cellTemplate

中使用columnDefs
$scope.gridOptions = {
 data: 'list',
 multiSelect: false,
 columnDefs: [{ field: 'name', displayName: 'Name'},
             { field: 'description', displayName: 'Description'},
             { displayName: 'Actions', cellTemplate: 
             '<div class="grid-action-cell">'+
             '<a ng-click="$event.stopPropagation(); updateThisRow(row.entity);" href="#">Update</a>'+
             '<a ng-click="$event.stopPropagation(); deleteThisRow(row.entity);" href="#">Delete</a></div>'}
            ]
    };