Modify list from api call

Hi there, I’ve got a list called “products” where each product has a name (text) and price (integer). I can display it perfectly in a repeating list, but I’m wondering how I can change a specific item.

I’ve tried adding an edit button to each cell of the repeating group. However, when I try to generate the event and select “make changes to thing,” I can’t select the desired item. Please note that the list is sourced from an external API, not from the Bubble database.

What should I do ?

Make changes to a thing is a database action. If the data is not on the database, you can’t change it with this action.
So you could do one of 2 things instead:

  1. Save the data you get from the API into your database and then make changes to that thing
  2. Store the data from the API as a list of things on a state and change it by updating the value of the state

Hi ranjit ! Thanks 4 your answer

  1. I’m try to avoid this
  2. What do you mean? Should I call again the api to get an update? When I receive the list, I store it in a state, but I can’t modify an element of that state list . How do that ?

Yes, you’re right. That would be tricky as hell.
You’ll need a data type.
How about converting the API data to a list of texts and then storing the texts in your state.
That way you can modify individual items via Set State → List of texts :minus item (current cell's text) plus item: (arbitrary text (modifying current cell's text))

1 Like

uff… it sounds aweful to develop and use , but it can works .
It would be great if bubble let me create the api’s call data type and modify those items on states anyway :frowning:

I’ll try those 2 options and evaluate execution time.
Thanks for your concern! <3

Cheers!

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