TheSwiss wrote:
Hi,
I have an entity collection bound to a WinForms DataGrid with both AddNew and Sorting enabled. When the user clicks into the bottom row and leaves it immediately by clicking somewhere except for a column header of the grid, a new row is added to and immediately deleted from the collection, as expected.
However, when the user leaves the unmodified addnew row by clicking on a column header and thus immediately initiates sorting the collection, the empty new row is NOT deleted.
(This applies to 2004.2 beta as well.)
Design flaw of DataGrid, EntityCollection, my app, or something else?
Databinding I think.
Databinding is something that after 10 years of misery it's still in a state where it can fall apart at any given moment. For example, the silly behavior that you move away from an empty row and it dissapears. That's not natural, you created a row, and if you move away from it, it should stay. Only when you press ESC it should go away, as that would roll back the edit cycle. But that's not the case.
The currencymanager keeps everything in sync, that is, it tries to and often fails. When you sort the grid, the 'current' row which was new is lost, as the only event I can raise is a reset, not a 'list has been sorted' or something. So it apparently forgets about the empty row it has to remove, as it doesn't know anymore which row in the sorted list was the new row it added.
BTW: Since this is my third posting, and I haven't mentioned it yet: EXCELLENT TOOL!!
Thanks!