I have an array that stores distinct Ids, but the user have the ability to edit these items.
I use this function to only add distinct values
var match = ko.utils.arrayFirst(addKo.SpecialCharges.AddedSpecialChargesList(), function(itemToAdd) {
return item.idx_Specials() === itemToAdd.idx_Specials();
});
if (!match) {
addKo.SpecialCharges.AddedSpecialChargesList.push(new vmFormElementSpecialCharges(item));
}
What I want is to edit an already existing item in this array without getting an error saying that the same item already exists!
Edit 1: Added Screenshot for better understanding