How to use temp value to store the changes made to table or listview

@doris.l funny coincidence, I just built a Retool app that utilized a very similar workflow. The use case was letting app users upload an arbitrary number of screenshots, with each having an optional description (text) alongside it. Here's how I did it:

  • Organize the UI for the CRUD operation (for me, a filepicker and text input)
  • Initialize a temp state variable (I had the initial value as an empty array)
  • Every time a user added a new "object" (screenshot and description), I would push it to the temporary state array via a Run JS Code query
  • All new objects are displayed in a listview component, with "edit" and "remove" buttons that would adjust the temporary state accordingly
  • On final submit, I'd push the value of the temporary state to the database via a bulk insert

Hope this helps!

1 Like