-2

How do you access these header's index in a grouped table?

table_screenshot

Bhavin Solanki
  • 4,740
  • 3
  • 26
  • 46
Jiel
  • 103
  • 1
  • 2
  • 12

3 Answers3

2

You can get column name using props.column. props.column will give you full column object so you can get index from it. props.column.field will give you column name title.

  1. You can check index with props.column.originalIndex
  2. The original row object can be accessed via props.row
  3. The currently displayed table row index can be accessed via props.index .
  4. The original row index can be accessed via props.row.originalIndex.
  5. You can then access the original row object by using rows[props.row.originalIndex].
  6. The column object can be accessed via props.column
  7. You can access the formatted row data (for example - formatted date) via props.formattedRow

For example :

<vue-good-table
  :columns="columns"
  :rows="rows">
  <template slot="table-row" slot-scope="props">
    <span v-if="props.column.field == 'age'">
      <span style="font-weight: bold; color: blue;">{{props.row.age}}</span> 
    </span>
    <span v-else>
      {{props.formattedRow[props.column.field]}}
    </span>
  </template>
</vue-good-table>

Source

Bhavin Solanki
  • 4,740
  • 3
  • 26
  • 46
1

i just found it out, the answer was just in the picture

{{props.row.vgt_id}}

Jiel
  • 103
  • 1
  • 2
  • 12
0

try this:

{{props.row.originalIndex}}

Hamed B
  • 183
  • 1
  • 12