user2894466
user2894466

Reputation: 137

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

My settings are as given below. when I click on the 'add new' link the ID cell is editable. We want to make that field uneditable.

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

Upvotes: 5

Views: 3761

Answers (2)

dash
dash

Reputation: 129

Use actions: false in root object

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

Upvotes: 0

user2894466
user2894466

Reputation: 137

Found the solution for this issue. we need to add an attribute addable: false to the respected column. This attribute is not mentioned in ng2-smart-table doc.

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

I found this solution in their example basic-example-load. https://github.com/akveo/ng2-smart-table/blob/master/src/app/pages/examples/server/basic-example-load.component.ts

Upvotes: 7

Related Questions