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!

Hi @Tess,

Can you talk to the team about a system to flag forum conversations that concern deprecated components?

It's very confusing looking at solutions to questions and then later realising it is about the old table or the old listview.

With thanks,

2 Likes

Yes! We've been discussing ways to audit the forum in general. Will bring it up with the team now :slightly_smiling_face: Thank you!