10

I'm working with v-data-tables of Vuetify and....

I want to change this text:

enter image description here

I have added this code but it isn't working:

enter image description here

Thanks!

Nacho
  • 628
  • 1
  • 12
  • 19

5 Answers5

21

You could use 'items-per-page-text':'products per page':

<v-data-table
  :headers="headers"
  :items="desserts"
  :items-per-page="5"
  item-key="name"
  class="elevation-1"
  :footer-props="{
    showFirstLastPage: true,
    firstIcon: 'mdi-arrow-collapse-left',
    lastIcon: 'mdi-arrow-collapse-right',
    prevIcon: 'mdi-minus',
    nextIcon: 'mdi-plus',
    'items-per-page-text':'products per page'
  }"
></v-data-table>

Please check this example

Yue JIN
  • 1,047
  • 1
  • 10
  • 20
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
8

The correct prop for Vuetify 2.X is items-per-page-text:

<v-data-table
  :footer-props="{itemsPerPageText: 'Rows count'}"
></v-data-table>
Yue JIN
  • 1,047
  • 1
  • 10
  • 20
Alexander Shkirkov
  • 3,527
  • 3
  • 17
  • 37
  • Your solution has worked for me perfectly, but I am still having one part without translation. I have two pages and I see "of" when it should be "de" (spanish). What is the property for that topic? – inane May 17 '21 at 17:03
  • 4
    @inane in your case it should be `:footer-props="{ pageText: '{0}-{1} de {2}' }` – Alexander Shkirkov May 18 '21 at 02:42
6
<template v-slot:[`footer.page-text`]="items"> 
  {{ items.pageStart }} - {{ items.pageStop }} de {{ items.itemsLength }}
</template>
Yue JIN
  • 1,047
  • 1
  • 10
  • 20
1

The best way I've ever found is language localization in the Vuetify configuration.

import en from "vuetify/lib/locale/en";
    
export default new Vuetify({
  theme: {
    themes: {
      options: {/*...*/},
      light: {/*...*/},
      dark: {/*...*/},
    },
  },
  lang: {
    locales: { en },
      current: "en",
  },
});

The above configuration causes all the Vuetify components (v-data-table) to be language localized.

Yue JIN
  • 1,047
  • 1
  • 10
  • 20
A Farmanbar
  • 4,381
  • 5
  • 24
  • 42
0

Very simple, at least in version 3.3.9:

<VDataTable :pageText="'{0}-{1} de {2}'" />
paulodrjr
  • 41
  • 4