4

我的设置如下。当我单击“添加新”链接时,ID 单元格是可编辑的。我们想让该字段不可编辑。

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

2 回答 2

7

找到了这个问题的解决方案。我们需要为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

于 2018-02-05T11:47:03.530 回答
0

actions: false在根对象中使用

tableSettings = {
      actions: false,
      columns: {
        lastname: {
          title: 'Last Name',
        },
      } // columns
  }
于 2020-10-24T07:13:32.307 回答