Deselect a row in table


I have a table with a single row selection option. Is there a way to deselect a row that is selected? I know if you select another row it'll deselect it but I'm looking to deselect it so that no rows are selected.


I don't believe there's a built in option but you can add a button that runs clearSelection() on the table - if you need to have it on the row click event rather than a separate button you'd probably need to write a JS query script:
Script wise you'd want to create a variable to hold the selected row id of the table. On row click event check if the new selected row id is the same as the variable and if it is the same then clearSelection() on the table and reset the variable. If it's not the same set the variable to be the newly selected id.
Caveat is that you'll need to keep the variable up to date if you have other controls that can change selection in the table but the logic should work
forum (3).json (183.2 KB)