I've encountered an issue where the edits made in table columns sometimes do not save, despite triggering the associated Postgres query. I have a table that displays multiple rows of information from my Postgres DB, and I need some columns to be editable, allowing users to type text into empty cells or change pills.
For each editable column, I have an event handler of type "Change cell," which triggers the respective Postgres query. Here's an example of the query:
UPDATE
public.example
SET
note = {{table1.changesetArray[table1.changesetArray.length - 1].note}}
WHERE
id = {{table1.changesetArray[table1.changesetArray.length - 1].id}};
However, I've noticed that occasionally the saving doesn't happen, even though the blue corner appears in the cell, indicating that the value has changed.
Has anyone else experienced this issue/does anyone have suggestions? Thank you!
I think what happens is that your query, even if successful, doesn't automatically clear your table's change set.
When the table's default save button is being used, it has the clear changeset integrated within it and it will clear the blue corner arrows. However, when you aren't using that save function, my recommendation is to integrate clear changeset within the query's success events.
Hi @Paulo , @MiguelOrtiz's solution actually doesn't solve our root issue. It was helpful and makes it easier to detect when a save event executed successfully, but it doesn't solve the issue of our saves being inconsistent.
The issue is that it's not clear to us why sometimes the save events don't happen. Perhaps a related observation is that after updating a cell and clicking away, which triggers an update event, we occasionally see errors like "X column cannot be null" which signifies an error that supposedly violates our Postgres database constraints even though the column values are never empty.