.NewRow() Error - An Item with the same key has already been added.


Author
Message
jsantos
jsantos
StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)StrataFrame Novice (104 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 87
Hello,

I am having an issue when calling .NewRow I get an error in the CreateShareAndAddBusinessObject function in BusinessBindingSource.vb (see attached image)

Before calling the .NewRow in our code the CurrentRowIndex = -1 which I expect as the BO should be empty. Then as soon as I call .NewRow I get an exception. When the error is thrown index = 0 when it should be 1 according to loReturn where it looks like there is already one record and then the error makes sense.

Any ideas?

http://forum.strataframe.net/Uploads/Images/c855b057-bc96-4ba1-a242-0e50.png
Replies
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, Edhy, the WPF ICollectionView and IEditableCollectionViewAddNewItem models take care of adding/editing an item when the view is sorted/filtered by holding the item to the side until the add/edit of the item is finalized through CommitAdd/Edit().  There's even a NewItemPlaceholderPosition to allow you to specify whether you want the blank new-item row on the top or the bottom.

Sounds great in theory, but the implementation has been a bugger because you have to have a custom enumerator that return the "fake" or shifted items.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Yes, Ben you are right.

I remember long time ago when I was starting with SF having this sort of weird outcome when using filter/sorting on a BO and adding new rows or deleting current one.  Careful is a most during those situation, but I must also say that I love the BO Filter/Sorting features since they have allowed me to deal with some custom processing in an easy way, again as long as I remember that I using a filter or sort later on BigGrin

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago
                     Yep, Edhy, the WPF ICollectionView and...
StrataFrame Team - 10 Years Ago
                         Yes, Ben you are right. I remember long time ago when I was starting...
Edhy Rijo - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
jsantos - 10 Years Ago
jsantos - 10 Years Ago
StrataFrame Team - 10 Years Ago
Edhy Rijo - 10 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search