Auto save function in tables

Hi

Is there a way to auto save all the changed values in custom columns in a table?

The goal is that the "Save changes" button is no longer necessary, but that the entire table is saved directly after a change.

Not that I know of, but I can see use cases for this. Might I suggest you move this to Feature Requests?

One major problem you will have doing this though is that it will require a round trip to the server for an update, another to the server to requery and then the table will need to be refreshed with the new values. This will cause a lot of flashing and activity within the app which could get very distracting.

So I might amend the request to add an onBlur event (fires when the focus on a component is lost) to the Table component that could then be used to fire a save() method which also does not exist. That way all the activity only happens after the user click out of the table somewhere which may be more intuitive and acceptable

Any updates on this request?

Hi @Gabriel_Aracena,

I agree with Bradly that this is not well supported :disappointed:

We are starting to look at how we can update the table to make bulk editing faster & easier, so we may have some features coming soon that will help with your use case.

In the meantime, I created a potential solution that seems to work pretty well. I will caution that I have not tested this very much and it's not necessarily the intended way of using the table component. If you decide to try out something similar, I'd recommend doing some testing to make sure the records are getting updated accurately. You'd also likely want to do some custom css to hide the save changes button. More info on custom css here: http://community.retool.com/t/how-to-write-custom-css-in-retool/2165

The idea is that you trigger a single record update query on cell change. You can restrict the query to only run if there are any values in .recordUpdates. I'm attaching a recording where it seems to be working well -- I am typing in a new name & clicking enter on my keyboard to save.

Final

1 Like

can you add a bigger screen shot? I can't read what is in query2? Thanks!

If you right click on the image and open in a new tab you can see it full size

Slight variation on the above. I wanted only the field that had been updated in the table to be updated in the database, rather than updating all the fields again so ended up doing the following. No real difference in terms of outcome but avoids updating lots of fields unnecessarily



. Excuse my scrappy JS.

2 Likes

This works for me and is a smart solution :)) Thank you Tess

1 Like

I have a request to do this with 'tab' functionality. when the used uses the 'tab' key to move from one cell to another, they would like the value they typed to be saved. It seems to work with the enter key, but I have not got the tab key working.

Thanks for the feedback @Michael_Hampton! We're looking into this internally. I'll post here when we're able to implement this