I'm extending our application to allow bulk edit of data by creating a datatable and then displaying in a grid and then allowing the user to edit to their heart's content. I would really like to be able to show the user which cells have been changed.. and as I try to commit them back to the original datasource (not using a regular datasource but by reading the data table and calling our API) I'd like to reset the highlighting for those that have been successfully updated.
Is there any way to do this highlighting? Perhaps by changing the font to a different colour?
I notice Heath Robinson had previously found a way to do this using timers which is a little inelegant. But also that there was an issue with this (http://ko.infragistics.com/community/forums/p/9254/36076.aspx#36076) - don't know whether it was a real issue, whether it was resolved or whether things have moved on since 2008 anyway
Thanks in advance
Hello,
Although we don't have an example that lists the grid's event's firing in order as you decribe we still have a complete list of the grid's events and their description. The list is part of our grid's API in our online documentation.
You can visit here under Public Events:
http://bit.ly/1wiuo7C
From the get go, once you bind your UltraGrid to any DataSource, the event that will fire first is InitializeLayout event.
Right after it, the event that will fire is InitializeRow event of your UltraGrid. This event will fire for each row in your UltraGrid. Then you can use Debug.WriteLine in each event handle you are interested in to determine the order.
Please let me know if you have any additional questions.
Hmm, thanks but that didn't really help.
I think part of the problem is that the row is not persisted to the datatable until you exit the row. I want to highlight the cell as soon as it has has been exited - so if the user goes to the next cell on the same row I still want the cell that was just changed to be highlighted.
So it seems that I can't use the datatable for this purpose... but of course I could go through the grid and set the Tag of every cell to the original value. But this means that I have both the grid and the data table now maintaining multiple copies of the data!
I tried to use the grid without the datatable to manage it all myself but then discovered that the grid has to be bound to a data source so that's no good. So looks like I have to accept holding lots of copies of the data in memory...
The datatable also has a special "feature" where if I have a string in a column in a row set to "xxx" and then change via the grid to "yyy" and then back to "xxx" it determines the row has been modified. Doh! And to be honest I have to be a little more sophisticated in my determination if something has been changed. For example I have a column that will contain a Boolean represented as "" (null), "True" or "False". And if the user edits it and changes it to " True" or "TRUE" then it's the same value and is essentially (for the purposes of writing back to our back-end DB) unchanged.
Is there any documentation that describes the events that are fired and in what order? So for example if I'm editing a cell and then click on a cell in a different row - I can understand which events fire, in what order and when in that process the data is persisted to the data table.. this is just an example of the sort of thing I'm looking for so don't bother answering this question - I'm just seeking the documentation!
I recommend reading up on a similar discussion here:
http://ko.infragistics.com/community/forums/t/29426.aspx
However, I attached a sample of my own below that I started that changes a cell's back color when they are updated. This is peformed in the BeforeCellUpdate event. Then, when the row is tabbed out or the user clicks out the row the AfterRowUpdate is fired. This event is fired after the cells are actually comitted to the data source. Here you can reset the cells back color back to the default by looping through the cells in the comitted row.
If you decide not to update the the rows on an individual basis you can use a button or another event that the user triggers to update the grid. There you can commit the entire grid and reset any back colors that were changed while the user was updating the grid. But in that case you would have to also loop through all your rows first.
Let me know if you have any questions.