Update listbox disabledValues

I have a listbox in my app and I am trying to disable an item from the list by updating the disabledByIndex to true but it's not working

This the code that I used in event handler
list_data_chunk.disabledByIndex[list_data_chunk.selectedIndex] = true

New to retool but also noted the above. Assume the .disabledByIndex only reports on status. What you can use is a variable that is tied to the "Disabled" of the individual line item as below

image

Here SY is a Boolean and has been set by the button to mark "South Yorkshire" as disabled

:wave: variable SY: {{ SY.value}} {{listCeremonialCounty.disabledByIndex.join(",")}}!

1 Like

@Kotin_karwak Thanks for replying.

I am actually new in retool too. Could you give an elaborate answer? I can't implement what you are doing here.

Also for better understanding of the problem, the list item kind of works as a trigger to trigger a workflow an once the workflow ran successfully, I would like to disable that item.

In the case above, I would have three Boolean variables for each county that toggles the disabled status of the line item in your case,
image

In the list view, each item will have the setup as below

once the workflow for that county has run, the variable will be set to 'true' i.e {{ !SY.value }} and hence the list will be as such. Haven't dealt with workflow yet but through the trigger, further actions can be run to set these variables.

Thank you for the explanation @Kotin_karwak

I guess it's ok to define variables for each item when you have less item in the list, also the items are not dynamic.
The items in my list are dynamic and sometimes it even has 50 items so it's not efficient to use separate variables.

So what I have done, is saved the item index for each selected item to a database then checked if the newly selected item exist in the database.
For now I don't know if I can achieve this in a easier way.