ng2-smart-table - 添加自定义操作按钮 - ng2-smart-table

标签 ng2-smart-table

我正在尝试向自定义操作添加一个按钮,但未在操作中添加一个新列,使该按钮与其他按钮重叠。

代码:

settings = {
    actions: {
      custom: [
        {
          name: 'Button',
          title: 'Button ',
        }
      ],
    },
    columns: {
      name: {
        title: 'Full name'
      },
      email: {
        title: 'Email'
      },
      lastLogin: {
        title: 'Last Login'
      }
    }
  };

我需要放一个图片链接,因为我在这里名气不大,而且图片工具对我来说被屏蔽了。

reaction image:

我究竟做错了什么?

最佳答案

你可以试试这个。
将您的设置更改为:

settings = {
hideSubHeader: true,
actions: {
  custom: [
    {
      name: 'yourAction',
      title: '<i class="ion-document" title="YourAction"></i>'
    },
    {
      name: 'editAction',
      title: '<i class="ion-edit" title="Edit"></i>'
    },
    {
      name: 'deleteAction',
      title: '<i class="far fa-trash-alt" title="delete"></i>'
    }
  ],
  add: false,
  edit: false,
  delete: false
}
...
};

然后将其添加到您的 component.scss 中
    :host /deep/ ng2-st-tbody-edit-delete {display: flex !important;
  height: 0 !important;
}

:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom {
  display: inline-block;
  width: 50px;
  text-align: center;
  font-size: 1.1em;
}

:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom:hover {
  color: #5dcfe3;
}

关于ng2-smart-table - 添加自定义操作按钮 - ng2-smart-table,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52086092/

相关文章:

css - 如何在 ng2-smart-table 上显示自定义图标?

Angular - 智能表格不会填满

javascript - ng2-smart-table 删除后不绑定(bind)

angular - 如何删除 ng2-smart-table 中的一行

javascript - 将值传递给扩展插件 ng2 智能表

html - 如何使用图标代替 ng2 智能表的按钮

javascript - ng2-smart-table如何更改自定义按钮在点击时的显示和隐藏

typescript - 使用 AngularFire 和 Firestore 使用 Ng2 智能表显示嵌套对象

angular - ng2-smart-table 动态更新列表