Click row

This is a new feature since version 1.2.4

click-row event emits when a table row is clicked. The argument of the event includes the item data that was clicked. If you are using multiple-selecting and show-index feature, isSelected and indexInCurrentPage will be also included.

Type declaration of event argument

type ClickRowArgument = Item & {
  isSelected?: boolean,
  indexInCurrentPage?: number,
}

Example

<template>
  <EasyDataTable
    v-model:items-selected="itemsSelected"
    show-index
    :headers="headers"
    :items="items"
    @click-row="showRow"
  />

  row clicked:<br />
  <div id="row-clicked"></div>
</template>

<script setup lang="ts">
import type { Header, Item, ClickRowArgument } from "vue3-easy-data-table";

// omit

const showRow = (item: ClickRowArgument) => {
  document.getElementById('row-clicked').innerHTML = JSON.stringify(item);
};

// omit
</script>
#PLAYERTEAMNUMBERPOSITIONHEIGHTWEIGHT (lbs)LAST ATTENDEDCOUNTRY
1Stephen CurryGSW30G6-2185DavidsonUSA
2Lebron JamesLAL6F6-9250St. Vincent-St. Mary HS (OH)USA
3Kevin DurantBKN7F6-10240Texas-AustinUSA
4Giannis AntetokounmpoMIL34F6-11242FilathlitikosGreece

row clicked: