No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Unable to translate the Q-table headers

    Help
    2
    2
    284
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bambinou last edited by

      Hello,

      I am not understanding the issue.

      The Q table headers are not translating. It is very strange because if I add $t(‘tables.surname’) to the template layout, it works on the fly, I can change the languages without any issues but as soon as I add this.$t(‘tables.surname’) in my columns object, the reactivity is not there. Any idea why, please?
      I thought perhaps I needed to add it to a computed property but is it possible to add an object as computed? If yes would you have an example please? Thank you.

      <template>
      <div>
          <q-table :data="data" :columns="columns" row-key="name" :pagination.sync="pagination">
            <template v-slot:body="props">
              <q-tr :props="props">
                <q-td key="name" :props="props">{{ props.row.name }}</q-td>
                <q-td key="surname" :props="props">{{ props.row.surname }}</q-td>
              </q-tr>
            </template>
          </q-table>
        </div>
      </div>
      </template>
      
      <style scoped>
      </style>
      
      <script>
      export default {
        data () {
          return {
            pagination: {
              rowsPerPage: 0,
              page: 1
            },
            selected: [],
            columns: [
            {
              name: 'name',
              align: 'center',
              label: this.$t('tables.name'),
              field: 'name',
              sortable: true
            },
            {
              name: 'surname',
              align: 'center',
              label: this.$t('tables.surname'),
              field: 'surname',
              sortable: true
            }
            ],
            data: [{
              name: 'Name1',
              surname: 'name 1',
            },
           {
            name: 'Name2',
            surname: 'name 2'
            }
            ]
          }
        }
      };
      </script>
      
      1 Reply Last reply Reply Quote 0
      • msfatgraycat
        msfatgraycat last edited by

        Have the same issue…

        1 Reply Last reply Reply Quote 0
        • First post
          Last post