user384496
user384496

Reputation: 180

ng2-smart-table: How to preselect dropdown with the current value in edit mode

I have a column that need to be a dropDown upon edit.

When i press edit i get the full dropdown but no selected value

Here is my code:

        CompanyName: {
          title: 'CompanyName,
          type: 'html',
          valuePrepareFunction: (cell, row) => {
            return row.CompanyName
          },
          editor: {
            type: 'list',
            config: {
              list: this.companies  // this.companies = [{value: 1, title: "TestCompany"]
            }
          }
        },

Upvotes: 0

Views: 1159

Answers (1)

Anup Das Gupta
Anup Das Gupta

Reputation: 771

Can you try-

valuePrepareFunction: (cell, row) => {
            return row.title
          },

Reference- https://github.com/akveo/ng2-smart-table/issues/665

Upvotes: 1

Related Questions