Use Check Box for Selection

With my table I would like to have the feature "Use Check Box for Selection" but I only want the user to select one item.

It seems that the "Enable Use Multi Row Selection" feature must be set to "On" if you want to "Use Check Box for Selection".

Is there any way of turning on the Check Box feature and limit to One Selection?

I am attaching a screen shot.

Mike

Hey @mdsmith1. In my view, it makes sense from a UI/UX perspective that checkbox selection is limited to multi-row selection. This indicates to users that multiple selections are possible. It also makes multiple selections easier, without having to hold down Ctrl or some other key whilst clicking on rows.

Such a UI element is somewhat redundant in a table with only single-row selection - and also takes up valuable real estate. You can customise the appearance of rows on hover and on selection to make interactions more obvious.

Ryan:
It seems that identification of the selection is easier if the check box is turned on. But I can find a way around it so I will not pursue this any further
Mike

You can always add a custom boolean column and set it to be true when {{table1.selectedRow.index === i}}!

Apr-14-2023 16-17-27

1 Like

Thanks Henry.

I have found another way around this but I will keep your solution in mind.
Thanks again.
Mike

Henry:
I have tried the best code I can convolute and I get an error message.
I am sending 2 screen shots.
Mike


Hey! You shouldn't need a separate query, if define a Custom Column in the Retool UI and give it the following settings it should work!

Henry:

I am trying to get the value of the Invoice Number (Invnbr) that is in the Checked row.

How do I get the Invnbr?

Mike

Oh my mistake! You might try using an event handler that references {{ table1.selectedRow.data.Invnumber }}:

Otherwise, if you use a JavaScript query or a script instead of a SQL query, you can call localStorage.setItem('minvnumber', talbe1.selectedRow.data.Invnbr).

Do either of those work?

Henry:
I got it to work but I had to add some extra code which you can see in the attached screens.
I run your code first which seems to get the pointer in the right place. This code on its own does not seem to run when clicked.
The second piece of code sends 'minvnumber' up to the Local Storage.
So I am out of the woods.
Thanks Henry.
Mike