Vue-good-table: how to add button each row

Created on 7 Sep 2018  路  2Comments  路  Source: xaksis/vue-good-table

Issue Type (delete the irrelevant ones)

  • [x] Question

Specs

What version are you using?
2.13.3

What browser?
All browser.

Thank you for your librarie. I would like to be able to add buttons to each line instead of selecting a line and clicking on the button. Like this image:

maxresdefault

It's similar to this https://github.com/xaksis/vue-good-table/issues/323 but I don't want my buttons to be included in the variable row.

Thanks for your help !

Most helpful comment

hey @nacimgoura you need to use a custom row template:
documentation - https://xaksis.github.io/vue-good-table/guide/advanced/#custom-row-template
in your case:

<template slot="table-row" slot-scope="props">
    <span v-if="props.column.field == 'action'">
      <button class="myButton" @click="doSomething(props.row)"></button>
    </span>
    <span v-else>
      {{props.formattedRow[props.column.field]}}
    </span>
  </template>

closing.

All 2 comments

hey @nacimgoura you need to use a custom row template:
documentation - https://xaksis.github.io/vue-good-table/guide/advanced/#custom-row-template
in your case:

<template slot="table-row" slot-scope="props">
    <span v-if="props.column.field == 'action'">
      <button class="myButton" @click="doSomething(props.row)"></button>
    </span>
    <span v-else>
      {{props.formattedRow[props.column.field]}}
    </span>
  </template>

closing.

Thanks :wink: I didn't understand correctly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LiamMcArthur picture LiamMcArthur  路  3Comments

advicepyro picture advicepyro  路  3Comments

oflittlemother picture oflittlemother  路  6Comments

davidohlin picture davidohlin  路  6Comments

hoanghiep1x0 picture hoanghiep1x0  路  5Comments