Hello!
New to retool but raring to learn.
Recently, I was trying to create a dashboard that would allow a user to approve / reject rows in a table based on an input in a form. I know that this resource clarifies how to add new rows to a table via a form, but it doesn't seem to go into detail about how to selectively change individual cells through a form.
I know you can make columns editable within tables by changing the specific column type to a text input column type, but the person I am building this out for would prefer to do it via an Approve / Reject Radio buttongroup on a form.
Would love some assistance in understanding if this is possible, thanks!
Yes, you can do this! A general approach is to reference the selected row of the table, and trigger an edit query via form submission, which then triggers a refresh of the original data:
If you have a table named table1, you can access the data of the selected row via the following syntax: {{ table1.selectedRow.data.id }}. Using this, you can create a new query to modify the database, then refetch the data underlying the table. For instance, if you're using a SQL database query2 would send a SQL query to your database that looks like UPDATE myTable SET columnName = newValue WHERE id = {{ table1.selectedRow.data.id }}.
Make sure you add the initial data fetch query to evaluate under "On success trigger" - this ensures that the initial data fetch is re-run after you modify the data.
If you're using an API, or another database, you would do something similar to the above example - modify the underlying data then trigger a data re-fetch.