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] Detect cell or value click in table?

    Framework
    1
    2
    148
    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.
    • ssuess
      ssuess last edited by ssuess

      I have poured over the table docs here (https://quasar.dev/vue-components/table) but have been unable to figure out how to detect when a cell (or that cell’s value) has been clicked (so that I can trigger a method with that value).

      I tried a value format with the following, but it outputs my source text in the cell instead of rendering it:

      format: (val, row) => `<span class="link" @click="setSearch(${val})">${val}</span>`
      

      Can anyone point me in the right direction? Thanks!

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

        Ok, I figured it out. I needed to create a template slot and then format that:

        <template v-slot:body-cell-myVal="props">
               <q-td key="myVal" :props="props">
                    <span class="link" @click="setSearch(props.row.myVal)">{{ props.row.myVal }}</span>
               </q-td>
        </template>
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post