Faulty value in selectRowKeys property of table component with active 'group by' column

  • Goal: I want to use the selectedRowKeys property of my table component (with active grouping) to insert selected values to a db
  • Steps: I tried a workaround where i filter out the faulty value in my JS transformer before the insert - it works, but it feels like a janky solution
  • Details: I'm using the table component with one column used as a 'group by' column, after selecting rows after the initial load, the component always includes the faulty value ":RETOOL_GROUPED_ROW:0" in the selectedRowKeys property
  • Screenshots:
    image
    image

Interesting, I seldom use group by column, but I wonder if this is intentional from the retool team but it would actually make more sense to have a different object for selected_groups.

In any case, I'm sure you have found a workaround, but in any case here is what you can do to find the keys {{ table1.selectedRows.map (row => x.id) }}

Can't be intentional as you can't select groups all at once at the moment. Interestingly enough your workaround would create a different problem, as in selectedRows there is also an undesired object with only null values (which we don't have in the table). Definitely has to be a bug :slight_smile: Thank you so much for answering

1 Like

Yeah, definitely feels like a bug!

Interesting! Thanks for bringing this up, @apaschen. The behavior that you're seeing is the result of the following settings:

image

When first loading the page, Retool tries to select the row with an index of 0 - which equates to the grouped row itself. :sweat_smile: The solution is to disable default row selection entirely or to instead specify a default using a primary key.

image

That should hopefully be an acceptable workaround, but I will still flag this internally as an opportunity to clean up the user experience. :+1: