Disabling Row Selection in Table Component?

Greetings, my Retool peeps. I did search for this on the forum, but got some answers that seem to be from an older version of the Table component.

  1. My goal:
    I'm using cloud-hosted Retool. I have a table component, which has multiple row selection as the default from the inspector. I would like to "lock" the rows selected via JavaScript in the Change event handler of another component on the page. For example, if the user selected rows 3, 5, and 8, I would like to disable the ability to change those selected rows, after the user chooses from another single-select component.

  2. Issue:
    I have tried table.setDisable(true), but that doesn't seem to work. The other suggestion was to use a local variable to store the row selection and force write those back, which seems a little clunky.

So, I'm just wondering if there is a cleaner way to do this.

Thank you.

Hi @MMax25,

Great question. I just did some experimenting with a table and it seems like this may be a limitation on the current table.

If you allow multiple rows of the table to be "selected" by another component (or by the user) the table will be in an active state and users will be able to click to change row selection.

If you disable row selection, user clicks won't change anything on the table. But at the same time, your select component won't be able to select rows either.

Could you give me more details about your use case? If you are looking to display row data once a user makes a click in a select component, there are likely some other component's that could be used to display the data.

I can also make a feature request for the ability to programmatically select rows in a table while having row click events disabled.

Hi, any updates on this, actually i wanted to use this same feature where you can programatically select rows but don't allow users to select rows at the same time, is there any work around for that if this feature doesn't exist?

Hi @Kushal_Loya,

It looks like this ticket was added into the "table v2" feature grouping so it is on our roadmap and will definitely be getting built out by our team.

It terms of work arounds, I can do some testing and see if there might be something we can do in the short term.

My thoughts from the previous testing is that the table and its rows will just not be selectable. But we could do some styling to make it "look like the rows are selected" for the user if the importance is visual.

Let me know more about your use case, if it is more important that the visual indicates rows are colored differently/selected. Or if the importance is the data, in which case we could use some variables or other components to keep track of row indexes and then grab that data and use it elsewhere!

1 Like

Hi @Jack_T is there an update on this Table V2 by any chance

We’d love to disable selection on rows when X or Y conditions are returning true without having to hide the entire table or use cluncky workarounds.

Thank you

Jerome

Hey @Jeje - the Row selection input does support dynamic statements, meaning you can easily set it to 'none' under certain conditions. Does that meet your needs? Or do you need certain rows to remain selected like @MMax25 and @Kushal_Loya?