How to deselect a row in a single-select table?

Right folks, I cannot exclude that the systematic problem is between the chair and the keyboard so please bear with me.

I can't figure out how to deselect rows in the table (new one, not legacy). This table is set in the Single row selection mode, so there isn't these cute little selection boxes at the start of the row, which simply highlights when you click on the row.

And I don't know how to deselect a row previously selected. I don't mean programmatically, I mean through user clicks. I can select a row by clicking on it, it highlights and reacts correctly with the event handlers, but for the life of me I cannot figure out how it is meant to be de-selected.

I have tried another left click on said row, as well as ctrl-click, capital-click, right-click... I'm running out of ideas.

What am I missing?

Thanks!

You would have to select another row to deselect the current row selected.

You're right there's no way to unclick but you can script it.
It's a clunky workaround though, adding an event handler on the table row click event and storing the selectedRow in a temp variable. Compare the row click event with the last clicked one and if it's the same clear selection and if it's different set the variable.
Alternatively have a custom button on the table footer that's called "clear selection"

Example:
forum.json (387.7 KB)

2 Likes

There is no way to deselect the current row.
You must select another row.

Thanks all - changing it to Feature Requests

1 Like

also interested in this feature.

Hey all! There is the clearSelection method available on the table. So you could handle this with an external button, toolbar custom button, or table event handler depending on the desired outcome.

Happy to also file the Feature Request. For clarity on the expected behavior, are you looking for the row to be de-selected when it is clicked again?

1 Like

I know you said 'not programmatically' but I don't think there is any other way, other than waiting for a Feature Update i guess. since you are using single row selection the event handler is actually very simple to get this working.

  1. create a new variable
  2. add an event to the table and copy the following:

7 lines of code. if you're a stickler, here it is in 6 lines tho lol:

if(variable22.value === table1.selectedRowKey){
  table1.clearSelection();
  variable22.setValue(null);
  return;
}
variable22.setValue(table1.selectedRowKey);

I created an example app of this method a few posts up in this thread :point_up:

Yes, a click again would be a very good way of deselecting a row. And the event handler associated would also be welcome, for example in order to clear any form fields related to the entry that is no longer selected

2 Likes

Internal request has been submitted and I can update this topic when there is any additional information to share. Thanks!

3 Likes