I want to be able to click the row that is already selected to go back to no selection (-1). How would I go about scripting that. The onClick
fires after the value changes, so that didn't work for me.
Just tried this out, and this seems to work. You'll need a custom property named prevRow
on your table, then for the mouseClicked
event, use this:
newRow = event.source.selectedRow
if newRow == event.source.prevRow and newRow >= 0:
event.source.selectedRow = -1
newRow = -1
event.source.prevRow = newRow
One catch though is that if you are testing too fast, I think it sometimes catches your second click as a double-click and doesn't de-select.
Edit: Oh, and I set the default value of the custom property to -1 to start with just to be sure it's initialized properly.
2 Likes
This works, but I'm not getting the same double-click behavior issue as you. The deselection always works for me.