We are trying to get the row and cell error glyphs to change immediately when the value of the cell changes. Our app has business objects that implement IDataErrorInfo and INotifyPropertyChanged. When a cell value changes in a child grid it can alter one or more cell values in the parent grid. If the parent grid cell does not meet certain conditions then we would like a row and cell error glyph to appear. After the child grid cell is modifed the parent cell glyph changes immediately, but the row glyph does not change until the row is selected.
I created a sample app that displays the behavior. It is very contrived, but my intent was to make it as simple as possible.
The app is currently using version 10.2.
Hi,
What do I need to do with this sample to see the problem?
I tried running the sample and checking the PhoneError column in the first row (Account = 0) of the bottom grid. This appears to change the value of the Phone column in all three rows in the parent grid and displays an error in all three.
the error does not appear until the change is committed to the bottom grid, of course. Simply checking the PhoneError doesn't do anything until the change it commited to the data source of the second grid. So nothing happens until you move the focus to another cell, row, or control.
The example itself doesn't make much sense. I just wanted to model something close to the way our app behaves and keep it small and simple. With that said, here are the steps,
I'm afraid I still do not understand. You seem to be contradicting yourself.
cobaia said:Error glyphs will appear immediately in the Phone cell of all three rows of the top grid
cobaia said:but the row error glyph does not appear until the row is selected
They appear immediately, but they do not appear until the row is selected. What row are you talking about? The row in the top grid or the bottom grid?
The change you make to the CheckBox cell in the bottom grid will not be written to the underlying data source until you leave the cell or lose focus on the grid. This is correct behavior. Is that the problem? You want to errors to appear as soon as the checkbox is changed and not when you leave the cell? If that's the case, then you can trap the CellChange event and watch for changes in the checkbox cell and call the Update method on the row to force the changes to be committed. But be aware that while this is safe for a Checkbox cell, it's not safe for other cells in the row. For example, if the user is typing into a date field, attempting to commit the changes while the user is typing can result in an exception, since what they type might not be a complete date, yet.
Mike, I respect your time and effort so I appologize for the confusing nature of the app. To be clear, there is no expectation that the glyphs change immediately when the checkbox is checked.
Here are to image that better illustrates what happens. The first is after openning the app, checking the top box then selecting the next row. All the cell errors in the Phone column appear perfectly, as they should. However, there are no row error glyphs.
Now select the Fred row from the top grid. The row error appears. How to get all the row errors to appear at the same time as the call errors.
cobaia said:Is DirtyChildElements is more efficient?
No, DirtyChildElements is less efficient. If Refresh works, you should use that.
Ok, thanks Mike. We were hoping to keep the logic in the business objects, but we had also considered a grid event based work around. However, we would have probably used UltraGrid.Refresh instead of DirtyChildElements. Is DirtyChildElements is more efficient? Anyway, thanks for the insight. Will implement suggested work around.
Aha! Now I get it.
My apologies, I missed that you were saying that the row image was the problem and not the cell image.
This looks like a bug to me. The grid is probably not accounting for that fact that changing a cell value can require the RowSelector for the row to be invalidated. I'm going to forward this over to Infragistics Developer Support so they can get it corrected.
In the mean time, you can probably work around this by manually dirtying the child elements on the grid. I tried this out in your sample and it works:
private void ultraGrid2_AfterRowUpdate(object sender, RowEventArgs e) { this.ultraGrid1.DisplayLayout.UIElement.DirtyChildElements(); }
Of course, your real application might not be so simple and you may need to use some other event that fires whenever an error condition might change.