【问题标题】:In UI Grid,How to add two buttons in a single cell在 UI Grid 中,如何在单个单元格中添加两个按钮
【发布时间】:2017-01-25 22:30:20
【问题描述】:

您好,我需要将两个按钮添加到单个列中。如何使用 UI-Grid (AngularJS) 来完成。

提前致谢:)

【问题讨论】:

    标签: angularjs angular-ui-grid


    【解决方案1】:

    您可以使用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>'}
                ]
        };
    

    【讨论】:

    • 谢谢你 Salih,它工作得很好,我用逗号代替了 '+' 。
    • 不客气 :) 你的意思是 '
      ' ,你用了逗号?
    • 如果有帮助请标记为anwwer
    猜你喜欢
    相关资源
    最近更新 更多
    热门标签