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

    How to use $t('message.hello') from vue-i18n as title in q-data-tabe?

    Help
    column datatable title vue-i18n
    4
    9
    4248
    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.
    • maximilianfixl
      maximilianfixl last edited by

      I’m using the vue-i18n library to get diffrent lauguages in .vue and I need to use it as column title in Quasar data-table.
      I treid to use it thruogh a variable, but it doesnt work for me.
      Any suggestions or experience for this case?

      1 Reply Last reply Reply Quote 1
      • J
        jimmack1963 last edited by

        I also gave up on computing the label for a q-collapsible, which I suspect is the same problem, and so I’d like to know what you find out.
        Thanks.

        1 Reply Last reply Reply Quote 0
        • maximilianfixl
          maximilianfixl last edited by

          I’m not smarter then before! Could’nt figured it out, how to manage it! If you’ll find an solution, please tell me you’r way… thx

          1 Reply Last reply Reply Quote 0
          • kenium
            kenium last edited by

            Did you try something like that:

            columns: [
            {
            label: this.$i18n.t(‘name’),
            field: ‘name’,
            width: ‘150px’,
            sort: true,
            type: ‘string’
            }]

            ?

            1 Reply Last reply Reply Quote 0
            • J
              jimmack1963 last edited by

              To be specific, the problem was to use a reactive variable to compose the label and have it change.

              1 Reply Last reply Reply Quote 0
              • kenium
                kenium last edited by

                Like the user can choose exactly the label for different language for a column?

                1 Reply Last reply Reply Quote 0
                • maximilianfixl
                  maximilianfixl last edited by

                  @kenium
                  It works like a charme! So logic! Inside of vue instance, reachable with this
                  thx

                  1 Reply Last reply Reply Quote 1
                  • kenium
                    kenium last edited by

                    @maximilianfixl My pleasure 🙂 Happy to help 🙂

                    1 Reply Last reply Reply Quote 0
                    • K
                      kowy last edited by

                      Sad. Currently @kenium 's trick doesn’t work for me. It fails on error: “TypeError: Cannot read property ‘t’ of undefined”.

                      Here is the complete code of component:
                      <template>
                      <q-table
                      :title = “$t(‘default.register’)”
                      :data = “tableData”
                      :columns = “columns”
                      row-key = “startingNumber”
                      />
                      </template>

                      <script>
                      export default {
                      data: () => ({
                      columns: [{
                      name: ‘startingNumber’,
                      field: ‘startingNumber’,
                      label: this.$i18n.t(‘startingNumber’),
                      }],
                      tableData: [{
                      startingNumber: 1,

                      }],
                      

                      }),
                      };
                      </script>

                      <style>
                      </style>

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