Walaa wrote:
I think the point is if you don't clear the entityCollection deleted entities won't get removed from your datagrid.
I think you may save the selected index somewhere and re-select it again after re-loading the entities, which might not be the best solution since a selected item might have different index when reloaded or might have been removed from the new entity collection.
So either leave it as it is, or try to search for the selected entity via its ID/PK and reselect it if it does exist.
At the moment the DataGrid has no idea when the EntityCollection is going to be updated. The code that refreshes the EntityCollection isn't very close to the grid.
I notice in the following thread that Otis mentioned a feature that might help:
[http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2365&HighLight=1](http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2365&HighLight=1)
He says;
"It will change, I don't know when. The current upgrade feature list has a 'refetch graph on existing entity(/ies)' feature planned, so I might be forced to fix it this week in the new code. I filed it as a bug in the bugtracker and I've planned to fix all bugs before the upgrade goes RTM so if it is not a breaking change, I'll probably fix it within a month time."
Did this ever get in to a release? It sounds like it might help.
Regards,
Ben