Dealing with form in listview

I'm new to retool, it's my 7th day of develop an app in retool and I'm using retool database.

I have a LISTVIEW that has a list of price record from database
So my question is,

  1. how can I access data from FORM in LISTVIEW to update the data from database
  2. how can I add button to create new empty row in the LISTVIEW
  3. how to delete the record

here's my screenshot of the app

I dont find solution anywhere, even chatgpt give me some weird answer lmao

thanks in advance!

Hi @ji_shu

Thanks for reaching out & welcome to Retool! :smile: Currently, chat gpt can be super helpful for code snippets for Retool, but I've found it's not great for knowledge about Retool components.

1). You can access the form data under the form name (ex form1[i].data):

2). If you want to manage the length of the listview programmatically, you can follow this example. Essentially, you can use temporary state, which can be written over, to determine the list length. Let me know if questions come up!

3). Do you mean delete the record from your underlying database? If so, you could add a button to the listview that triggers a delete query for that dynamic list item. The example linked above in #2 also has a delete functionality!

Please let me know what questions come up!