Using Knockout.JS 3.0, I am trying to create an observable array and then update that array in my SelectedCustomer.subscribe function. My variable notes loads fine and this is what it returns in my console log: [Array[7]] but when I log my observableArray notesTable it only logs []. Basically, I have a foreach binding that creates a table based on the array and it's not loading any data.
self.notesTable = ko.observableArray();
self.SelectedCustomer.subscribe(function () {
var x = document.getElementById('customerselect').value;
if (x != "Select A Customer") {
var notes = GetNotes(x);
console.log("notes =");
console.log(notes);
self.notesTable(notes);
console.log(self.notesTable);
}
});
console.log(self.notesTable());
? – Paul D.