Conditionally add new rows to table

It would be great if a table.addRow or table.addNewRow function would be exposed at code level. My us case would be to being able to add conditional or selection logic to adding a new row.

1 Like

Hi @aneri,

Thanks for the feedback! I split this into a new topic because it would be helpful to hear more specifics

Not sure if it helps, but you can conditionally show/hide the β€˜Add row’ button in the toolbar. You can also add conditional logic and/or a confirmation modal to the table query.

1 Like

Hi Tess,

Thanks for your reply.

Since my first post, I've learned a lot about using newRows and changesetArray to save changes, so I've already found a good solution for what I wanted to do using the table's native toolbar buttons.

But what if I wanted to create my own custom buttons and implement my own Save functionality?

For editing, there's no problem. I can already type in the existing cells and then click my own button to Update.

But, as far as I know, there's currently no way to programmatically add a new empty row to the table.

For this, it would be handy to have a table.addRow method to use in an Add New Row button. Then I could type in the empty row and then press another Save button to save the new data to the db.

I hope this makes sense. Keep in mind that I'm a beginner, so if I've missed anything, I'd be happy to hear suggestions and solutions.

1 Like

Good question! Technically, if your database or api can accept null values, you could have a query that adds a new row where all values are null. Then, you could edit the null values in the table and save the changes to the record.

However, we don't currently have a way to programmatically add an empty row :disappointed_face: