If the db replaces instead of updates the selectedItem it won't be found in
the ArrayCollection and selectedItem will become null
Thanks for your reply harUI, the record coming back from the db is exactly the same as the one it is replacing.
1 person found this helpful
Unless you have implemented IUID on the object, it doesn't matter if it
contains the same values, it only matters if it is the same object.
Run a test, does oldObject === newObject?
Thanks for your reply harUI. I fixed the problem by assigning the properties inside the object coming back from the db into the selectedItem's properties (using a for each in). Now the selectedItem remains after the sort.
I guess it is exactly as you say: if I use the same object, the selectedItem stays.
Thanks for your help!