当用户点击 ng2-smart-table 中的 'add new' 时禁用单元格

disable cell when user click on 'add new' in ng2-smart-table

我的设置如下。 当我点击 'add new' link 时,ID 单元格是可编辑的。我们想让该字段不可编辑。

mySettings = {
columns: {
        id: {
            title: 'ID',
            editable: false,
        },
        name: {
            title: 'Name',
        },
        lastname: {
            title: 'Last Name',
        },
    }
};

已找到此问题的解决方案。 我们需要向受尊重的列添加一个属性 addable: false。 ng2-smart-table 文档中未提及此属性。

tableSettings = {
    mode: 'inline',
      columns: {
        name: {
          title: 'Name',
          editable:false,
          addable: false,
        },
        lastname: {
          title: 'Last Name',
        },
      } // columns
  } 

我在他们的示例 basic-example-load 中找到了这个解决方案。 https://github.com/akveo/ng2-smart-table/blob/master/src/app/pages/examples/server/basic-example-load.component.ts

在根对象中使用actions: false

tableSettings = {
      actions: false,
      columns: {
        lastname: {
          title: 'Last Name',
        },
      } // columns
  }