Hi
I have an UltraGrid bound to a DataTable where each column can be saved individually. Is there any way that after a succesful Save operation I can reset the OriginalValue of each cell in that column to whatever the (current) Value is?
Thanks
I don't really understand what you mean. The grid will display whatever data exists in it's DataSource. There is no way to do anything else.
You cannot set the "OriginalValue" on a cell, this property is handled internally by the grid.
OK let me try give some more detail. Imagine the grid looks like this:
Name | Telephone 1 | Telephone 2---------------------------------------------------------Person 1 | |Person 2 | |...
Value and OriginalValue for Telephone1 and Telephone2 for both persons is null. Next, I enter the following:
Name | Telephone 1 | Telephone 2---------------------------------------------------------Person 1 | 12345 |Person 2 | 98765 |...
OriginalValue for Person1.Telephone1 is null but Value is "12345". OriginalValue for Person2.Telephone1 is null but Value is "98765". At this point I click Save and want to save all changes in column Telephone1. When this operation succeeds, I would like to have:
Person1.Telephone1: OriginalValue=12345, Value=12345Person2.Telephone1: OriginalValue=98765, Value=98765
Currently what happens after the save, Person1.Telephone1.OriginalValue remains null which might be true in the context of the grid but does not work for me since I want without refreshing/reloading the grid to "reset" the original values. Something like:
cell.AcceptChanges();
Hope this makes more sense.
Okay, so you don't want to set the OriginalValue, you just want to commit the changes in the grid. That's a different story. :)
But, there's no way to do that. OriginalValue is really intended to be used by the grid. It's basically used in order to store the original value of the cells so that when the user presses escape to cancel an update of a row, the grid can revert the row or cell back to it's original state.
I don't see any way to get the grid to recognize that the data has been "committed" or accepted without re-setting the grid's DataSource and creating a new set of rows.
If you want to keep track of changes to the data, you are probably better off using your data source to do it, rather than the grid. If you are using a DataSet or DataTable, they have a lot of support for this kind of thing.