Table: Unexpected behaviour with header checkbox

I am trying to create the typical UX where you can click a checkbox in a table header and it selects/deselects all of the items in the table. However, it seems like when an individual record is selected/deselected, it no longer gets selected with the header checkbox.

Setup:

  • State on the repeating group called “Selected records”
  • Workflow on header checkbox: sets the above “selected records” state with all table records (when checked), or sets the state to null (when unchecked)
  • Workflow on individual checkbox: adds the record to the “selected records” state (when checked), or removes the record from the state when unchecked.
  • Conditionals on individual checkbox: Preset state is “checked” when the record is contained in the state, and “unchecked” when the record is not contained in the state.

Any ideas on what could be going on?

CleanShot 2023-03-23 at 11.05.54

This is why (from bubble manual on checkbox element):

Dynamic status
This option is only visible if Preset status is set to Dynamic. Specifying a dynamic yes/no value determines whether this element starts in an on or off state. When the dynamic value changes, e.g., the user modifies data that the dynamic status field references, the checkbox will change to reflect the new value. This continues until the user clicks on the element and changes the state, in which case the state will be determined by their selection rather than by a dynamic value.

I had a similar problem in one of my apps while using checkboxes in a filter section (multiple checkboxes to choose filter options). I needed all checkboxes to reset as soon as user clicks on “reset filters” button. To resolve the issue I had to group checkboxes and use “reset inputs” actions in workflow.

Ok I now understand why this is happening. Thank you.

Unfortunately I don’t think your reset input solution will work for me, perhaps you can elaborate a bit? I did try this, but the only option is to reset “relevant inputs”, which does not appear to include the checkbox in the repeating group, when the workflow is triggered by the checkbox in the table header.

Not at my desktop right now. Can you try to include RG checkbox in a Group and then use “reset data” workflow action?

Yes I did just try this and it seems like I can’t access any groups inside a repeating group for the reset data action. They don’t show up in the option list.

I also just tried to display a list in the repeating group (the same list that is being displayed) in hopes that it would refresh it, but that didn’t work either.

I’m haven’t worked with checkboxes elements for a while, in my projects I prefer to use icons as they are more flexible and UI friendly from my POV. So one option is to replace checkboxes with icons and make all the logic of selecting/deselecting via custom states. Or wait for somebody who knows how to fix checkbox behaviour in your case :slight_smile:

1 Like

That is a good idea. I don’t particularly like the look of the checkbox anyway. I was thinking of a checkbox plugin but icons is a way better idea. Thanks for that.

I did figure it out just now. Instead of display list, it’s clear list. Clearing the list refreshes it to the original list set on the element and resets the checkboxes. But that obviously comes with some limitations.

Edit: Marking this as the solution since it seems to be the technically correct answer to the original question, but using icons instead of checkboxes seems to be a nice solution as well.

This topic was automatically closed after 70 days. New replies are no longer allowed.