# Editing table data

**URL:** <https://forum.inductiveautomation.com/t/editing-table-data/84563>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 22, 2024, 11:25am UTC](https://forum.inductiveautomation.com/t/editing-table-data/84563 "2024-01-22T11:25:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leigh.shannan](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Leigh.shannan](https://forum.inductiveautomation.com/u/Leigh.shannan)\
**Post date:** [January 22, 2024, 11:25am UTC](https://forum.inductiveautomation.com/t/editing-table-data/84563/1 "2024-01-22T11:25:44Z")

</div>

Hi, I have searched the forum and seen similar posts, but so far, the responses haven't helped me solve my issue, so I am starting a new topic.

I have a perspective table which is populated with event data from a database table using a named query. I would like a user to be able to approve/deny the events and leave a comment. To do this I have 2 columns. A Boolean, to approve/deny the event, and a string column so approver can leave a comment.

Ideally, I would like to allow the user to go through the entire table updating the two columns and then once they are happy with all the changes, commit all of them to the database in one go.

I have set these as editable columns, however when the cell value is edited, as soon as you click off the cell, the data reverts back to the original value.

Is this because of the binding on the data property of the table?

If so, how do I keep the changes made in the table until I am ready to commit them?

Will I have to commit each cell value change as I go along?

Thanks,  
Leigh

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 22, 2024, 11:58am UTC](https://forum.inductiveautomation.com/t/editing-table-data/84563/2 "2024-01-22T11:58:08Z")

</div>

@Leigh.shannan, as this is an Ignition question I have moved it from General Discussion to the Ignition forum.

Regarding the problem, I think you need to update the table's data property using the onEditCellCommit event.

You might find it useful to also log the approver's username and approval timestamp.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 22, 2024, 1:33pm UTC](https://forum.inductiveautomation.com/t/editing-table-data/84563/3 "2024-01-22T13:33:15Z")

</div>

> [@Leigh.shannan](#):
>
> Will I have to commit each cell value change as I go along?

You have to commit it **somewhere** , where it will feed back into the table display.

I recommend you create two custom properties, either in the view or in the table. Move the query binding to the first, which I would name `raw`, and have it deliver in dataset format. The second, which I would name `current`, would have an expression binding that adds any additional columns to `raw` needed for managing state. (Or just a property binding to `raw` if that suffices.) Finally, bind the table's data prop to `current` with an expression/script to jsonify it as needed for your display.

The table's `onEditCellCommit` event would update the `current` dataset, which would then propagate naturally to the table display.

Your "Save" button would loop through the rows of `raw` and `current` together, constructing and sending SQL updates where they differ. Then after all updates, refresh the query binding.

{ For bonus points, your jsonification binding could also compare to `raw`, adding highlighting styles to edited cells. }
