Trigger on deselection of QTable rows
-
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#L539Is there a function I take advantage that trigger on deselection of checkboxes?
-
@Mak-NOAA just do an inverse assignment on your event handler ie.
props.selected = !props.selected
. -
@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#L12where 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”.
-
@metalsadman any thoughts here before you sleep?
-
@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)
. -
Thanks @metalsadman I’m gonna try isRowSelected
-
@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?
-
@Mak-NOAA see my pr on your repo.
-