How do I access a particular item on the List widget?

This question was asked on our Discord by one of our users; following is the use-case:

How do I access the first item from a list widget? I populated a list widget via a query, and I want to save a value associated with the first item in the list to the Appsmith store.

The items inside the list widget could be accessed using straightforward JS syntax.

On lists, we can access the first item using {{ListName.items[0]}} and further select the widget that you want to extract the data from.

For eg: {{ListName.items[0].InputName.Text}}

1 Like