Hide or disable row actions on add new row

@Tess Is there a way to hide or disable row action buttons for new rows which haven't yet been saved?

I'm using the new table compont to let users add, edit, and delete records in our database. When a user adds a new table row, the delete action button I've set up is visible and clickable and I'd prefer to disable or remove it. The delete relies on a record id which the row doesn't have since it hasn't been saved to the database yet.

I'm not seeing newly created, unsaved rows appear in currentRow which is what I was hoping to use. Any conditional I've tried in the disabled/hidden field for actions is ignored by newly created, not-yet-saved rows.

1 Like

:thinking: I'm not seeing a way to do this, but I'll put in a feature request

1 Like

Hi @Tess

I’m currently working on a project and ran into the same issue. Our QA tester pointed out that it’s quite confusing for users.

Would you mind taking another look to see if it’s possible to disable the action for new rows, or if there’s maybe a workaround available in the meantime?

Thanks!

3 Likes

Hi @JetzeJanssens,

Thanks for checking in

:thinking: It seems like you can use {{!currentRow}} or {{ table4.newRows.length===0 }}, but it will disable the action for all rows while the new row editor is open. Would that work for now?

Unfortunately, I haven't found a good way to hide the button in the new row

Hi @Tess,

I tried the options you suggested β€” both {{ !currentRow }} and {{ table4.newRows.length !== 0 }} β€” but unfortunately, they only affect the existing rows. The actions are still visible and active on the new row :grimacing:

Hmm that was working for me last week, but I am now seeing the same behavior as you are :disappointed: Sorry about that - I wish I had other ideas!

I'd like to find a solution for this as well.

Hi @el.axe,

How are you adding a row to a table?

One option could be that to disable row actions, instead of using {{!currentRow}} or {{ table4.newRows.length===0 }} , you could use a variable set to a boolean that you flip between true and false based on if you want the row actions to be accessible such as when a new row is being added but has not yet been saved.

1 Like

Hi @el.axe,

Just wanted to check in and see if my suggestion was helpful.

In my comment, if you have a button to 'create a new row' that button could have an event handler to turn off all row actions until the 'save' event fires and that save event action could have logic added to flip that boolean back to allow for row actions to appear again.

The one case this wouldn't cover would be if you have a newly created and unsaved row but want to execute a row action of an existing and already saved row. If that is a use case you would like covered I can make a feature request to have the table allow for row actions on all rows besides new unsaved rows.