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

    Trigger on deselection of QTable rows

    Help
    2
    9
    460
    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.
    • M
      Mak-NOAA last edited by

      I looked at the QTable API and I could not find a trigger that I can call upon deselection of the rows. I’m trying to enable/disable a Delete button depending if a row is selected however when a user checks a box on a row but then unchecks that same box, I don’t have a trigger such as “selected-rows-label” function to disable the Delete button again.

      Here’s a code snippet:
      https://github.com/nwfsc-fram/boatnet/blob/master/apps/obs-web/src/views/DebrieferTrips.vue#L539

      Is there a function I take advantage that trigger on deselection of checkboxes?

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

        @Mak-NOAA just do an inverse assignment on your event handler ie. props.selected = !props.selected.

        1 Reply Last reply Reply Quote 0
        • M
          Mak-NOAA last edited by

          @metalsadman sorry not following here…so I have this line:
          https://github.com/nwfsc-fram/boatnet/blob/master/apps/obs-web/src/views/DebrieferTrips.vue#L12

          where I call “getSelectedString” function upon “selected-rows-label” , then that function decides if there’s anything checked to make sure to enable the Delete button. However when I uncheck a box, the “getSelectedString” doesn’t get called, so how do trigger some function upon unchecking? Not sure how to inverse the call to “getSelectedString”.

          1 Reply Last reply Reply Quote 0
          • M
            Mak-NOAA last edited by

            @metalsadman any thoughts here before you sleep? 🙂

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

              @Mak-NOAA there might be a better way. See the qtable api card at events and methods part. Theres this isRowSelected method that take’s your qtable’s rowkey to select that specific row. Give your qtable a ref then you can $refs.myqtable.isRowSelected(props.row.mykey).

              1 Reply Last reply Reply Quote 0
              • M
                Mak-NOAA last edited by

                Thanks @metalsadman I’m gonna try isRowSelected

                1 Reply Last reply Reply Quote 0
                • M
                  Mak-NOAA last edited by

                  @metalsadman I implemented the method isRowSelected but how do I get it called isRowSelected?
                  See https://github.com/nwfsc-fram/boatnet/pull/603/commits/4e6d3deeb65b0567bf0b75d9d58c44cb295f4e08
                  nothing is being spit out on the dev console upon selection or deselection.

                  I need the event to be upon deselection so there’s now key here.

                  I need something in the
                  <q-table>…
                  :deselection=isRowSelected
                  …
                  </q-table>

                  is that “deselection” possible? and what is that event?

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

                    @Mak-NOAA see my pr on your repo.

                    1 Reply Last reply Reply Quote 0
                    • M
                      Mak-NOAA last edited by Mak-NOAA

                      Thanks @metalsadman that fixed it, thank you, I didn’t know

                      @update:selected
                      

                      was an event.

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