0

I use vuetable 2 in the project. In this table I take data from json. It is necessary to do, for example: There is a column to Order, in it information ORD1231 ** and so on. When you click on one of the cells, the order goes to another page with a dynamic id. Actually a question, how in vuetable to push router-link?

Serpent
  • 3
  • 3

1 Answers1

3

You can use __slot special field to user router-links.

Inside your <vuetable>, use <template slot=()>

<vuetable ref="vuetable" :fields="fields">
    <template slot="code" slot-scope="props">
        <router-link :to="props.rowData.code"> 
            {{ props.rowData.code }}
        </router-link>
    </template>
</vuetable>

and in your script

data() {
  return {
    fields: {
      {
        name: '__slot:code'
        title: 'Your Title'
      }
    }
   }
}

You can access your data with props.rowData and props.rowIndex attributes.

Hamatti
  • 1,210
  • 10
  • 11