Issue with Updating Individual ListView Instance Based on Multiselect Input

I hope this message finds you well. I'm currently working on an application and I've encountered an issue I hope you can help me solve.

In my application, I have a ListView where each instance contains a multiselect input. Each time an item is selected within a given instance, it triggers a Firestore query getExercisesByObjective. The result of this query is then meant to be used to populate another multiselect input, ExeByObjMultiselectListbox, within the same instance of the ListView.

My problem is that when I select an objective and trigger the query, the result updates the ExeByObjMultiselectListbox in all instances of my ListView, rather than just the one where the selection was made. I'd like to update the ExeByObjMultiselectListbox only within the specific instance where the objective was selected.

Could you provide some guidance on how to do that ?

Many thanks,

Best Regards,

Sarah

Hi @squero :slight_smile: Nice to hear from you!

This sounds definitely doable :eyes:

Would you mind sharing how you're currently triggering the Firestore query? Are you using the i variable anywhere?

https://docs.retool.com/docs/create-custom-list-views#the-i-variable

Hi Victoria,

Thank you for your response. I was able to solve my previous problem using the i variable, however, I'm now facing a different issue with the ListView.

In my ListView, users can select an objective from a select field. This filtered exercises are then displayed in a MultiSelectListbox, called ExeByObjMultiselectListbox. The user can then select exercises from this list, which are displayed in a reorderable list.

When the user selects a new objective, a new list of exercises is displayed, and they can add new exercises to the reorderable list.

The total selection of exercises is stored in a temporary state totalSelectedExercises.

However, I'm facing a couple of issues with this setup:

  1. When an exercise is deselected from ExeByObjMultiselectListbox, it still remains in totalSelectedExercises. I would like it to be removed from totalSelectedExercises when it's deselected.
  2. If an exercise that was previously selected is included in the new list of exercises in ExeByObjMultiselectListbox, I would like it to be displayed as selected.

Despite several attempts, I haven't been able to resolve these issues. I would greatly appreciate your assistance in finding a solution.

Thank you in advance for your help.

Hey @squero! Sorry for the delay here. Are you still blocked here?

How are you currently trying to set exercises in totalSelectedExercises? Are you using a JS query or something else?