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

    Single Selection on datatable activating all checkboxes

    Help
    3
    4
    720
    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.
    • V
      vrn.dev last edited by

      I have been trying to use the single selection feature on datatables on v1.0.0-beta.18 and I am facing an issue where I need a single selection on a row, when I select any row checkbox, all rows are selected, but only the selected row is showing up on the selected array.

      Template:

      <q-table
      :data="tenants"
      :columns="columns"
      row-key="name"
      :filter="search"
      selection="single"
      :selected.sync="selected"
      >
        <template v-slot:top-right>
          <q-input borderless dense debounce="300" v-model="search" placeholder="Search">
          <template v-slot:append>
            <q-icon name="search"/>
            <q-btn flat round icon="cancel" @click="resetSearch"/>
          </template>
        </q-input>
      </template>
      </q-table>
      

      Script:

      data: () => ({
          search: '',
          tenants: [],
          selected: [],
          columns: [
            {
              name: 'uid',
              label: 'UID',
              field: 'uid',
              required: true,
            }, ... etc
      

      Screenshot attached. As it can be seen only first row is selected (ripple is still seen)
      Screen Shot 2019-04-24 at 2.35.00 PM.png

      Would appreciate any help to trouble shoot this issue.

      PS: ‘QCheckbox’ is registered in quasar config file

      1 Reply Last reply Reply Quote 0
      • T
        turigeza last edited by turigeza

        The row-key="name" is missing in the object. You have that within details. Btw this would also happen if you did not specify the attribute row-key.

        1 Reply Last reply Reply Quote 0
        • V
          vrn.dev last edited by

          Thanks for pointing that out. For some reason I was under the impression row-key="name" referred to the name field in the column array

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

            @vrn-dev it refers to a prop of the object array you passed to data prop, usually i set it as the __index since quasar sets it uniquely for each row than a name which has tendencies to be duplicated.

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