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

    [Solved] v0.15 QTable Custom Cell Not Working

    Help
    3
    5
    1972
    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.
    • S
      snowdrop last edited by snowdrop

      I’m trying to convert my code from v0.14.9 QDataTable to v0.15.1 QTable but it seems that custom cell rendering does not work. Here is my sample of my code:

      <q-table
          :data="data"
          :columns="table.columns">
          <q-td slot="body-cell-address" slot-scope="props" :props="props">
              Custom Text: {{props.value}}
          </q-td>
      </q-table>
      

      The table works as expected, but if want to display custom data on the addresscolumn by adding a slot with name body-cell + column-name, the Custom Text: is not rendered. Am i doing something wrong with <q-td>...</q-td> component?

      1 Reply Last reply Reply Quote 0
      • H
        Heisenberg last edited by

        In quasar.conf.js make sure you have entered QTd

        framework: {
            components: [
                'QTable',
                'QTd'
            ]
        }
        

        and try change tyour code in

        <q-td slot="body-cell-address" slot-scope="props" :props="props">
            <span>Custom Text: {{props.value}}</span>
        </q-td>
        
        1 Reply Last reply Reply Quote 0
        • S
          snowdrop last edited by snowdrop

          @Heisenberg, yes I’ve done that before I’ve posted it. Anyway, the problem was fixed by adding name field in my table.columns value like this:

          {
              label: 'Address',
              field: 'address',
              name: 'address', // adding this line fixed it
              type: 'string'
          }
          

          I’ve read the docs and the definition is kind of vague for me on the topic about custom cell rendering.

          1 Reply Last reply Reply Quote 1
          • C
            carueda last edited by

            Thank you @snowdrop, I was having the same issue with no much luck from the docs, until I found your solution here!

            1 Reply Last reply Reply Quote 0
            • S
              snowdrop last edited by snowdrop

              @carueda You’re welcome. I was about to ask this on Discord but decided to put it up here so that anyone with the same problem could still look it up. 🙂

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