angular - ng2-smart-table 中的复选框

标签 angular ng2-smart-table

我在我的项目中使用 ng2-smart-table,我想添加一个带有复选框的列,在渲染时将根据绑定(bind)表格的对象进行检查。 在对象中,有一个带有 bool 值的字段,它将确定复选框是否被选中,并且在复选框中进行更改后,更改后的值应该可用。

最佳答案

您需要设置过滤器类型复选框

passed: {
    title: 'Passed',
    filter: {
      type: 'checkbox',
      config: {
        true: 'Yes',
        false: 'No',
        resetText: 'clear',
      },
    },
  },

在您的数据中您需要传递复选框值

data = [
{
  id: 4,
  name: 'Patricia Lebsack',
  email: 'Julianne.OConner@kory.org',
  passed: 'Yes',
},
]

试试这个例子 Checkbox, Select and Completer filter types

关于angular - ng2-smart-table 中的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51497047/

相关文章:

angular - 如何过滤ng2智能表中valuePreparefunction返回的自定义数据

angular - 如何从 http 请求将数据传递给 ng2-smart-table renderComponent?

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

Angular2 ng2-智能表排序

angular - 类型错误 : undefined is not a function when importing two modules in Angular

javascript - 推送数组中的值以匹配特定格式

javascript - parse Int 减法在 JS (Ionic 5 + Angular) 中如何工作?

javascript - 如何以 Angular 重置ng-select

Angular 2 和 Ionic 2 : What are the differences between constructor, ionViewDidLoad 和 ngOnInit 方法

angular - 如何更新 ng2-smart-table 中的占位符文本?