Click here to Skip to main content
15,886,786 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
getting duplicates from when adding new item to the observable computed array and if modified not getting the latest updated values. here is the piece of code.

JavaScript
self.admitDiagnosisList = ko.observableArray();
            ko.computed(function () {
                if (patientContext().Visit) {
                    $.each(patientContext().Visit.AdmitDiagList, function (index, value) {
                        return self.admitDiagnosisList.push(value.DisplayName);
                    });
            }
        });


What I have tried:

if (patientContext().Visit) {
$.each(patientContext().Visit.AdmitDiagList, function (index, value) {
return _uniq((self.admitDiagnosisList.push(value.DisplayName))),this);
});
}

tried to make it unique but not working
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900