【问题标题】:Is it possible to customize the column header of ng2-smart-table with custom component or any other way?是否可以使用自定义组件或任何其他方式自定义 ng2-smart-table 的列标题?
【发布时间】:2020-01-29 23:21:25
【问题描述】:

我知道有一种方法可以将 customComponent 添加到 ng2-smart-table 单元格。有什么办法可以对列标题做同样的事情吗?基本上我想在列标题标题旁边添加一个帮助图标,并向图标添加一个点击事件。

在文档中找不到任何此类现成的配置。

【问题讨论】:

    标签: javascript angular ng2-smart-table


    【解决方案1】:

    这个例子可能对你有帮助

    settings = {
        actions: {
          delete: false,
          custom: [
            {
              name: 'activate',
              title: '<i class="nb-checkmark"></i>'
            }
          ],
          position: 'right', // left|right
        },
        add: {
          addButtonContent: '<i class="nb-plus"></i>',
          createButtonContent: '<i class="nb-checkmark"></i>',
          cancelButtonContent: '<i class="nb-close"></i>',
        },
        edit: {
          editButtonContent: '<i class="nb-edit"></i>',
          saveButtonContent: '<i class="nb-checkmark"></i>',
          cancelButtonContent: '<i class="nb-close"></i>',
        },
        columns: {...}
    }
    

    您可以参考此来源以了解如何处理您的自定义操作事件:https://github.com/akveo/ng2-smart-table/blob/master/src/ng2-smart-table/components/tbody/cells/custom.component.ts

    https://github.com/akveo/ng2-smart-table/issues/779

    【讨论】:

    • 如果我能很好地理解问题,这不是一个好的答案,因为您应该将一些代码放入示例中为点的列中......这是与标题而不是行相关的问题。顺便说一句,您的第一个链接指向 404。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多