here`see my fiddle
http://jsfiddle.net/kirannandedkar/JUChh/2/
When i click on name it doesnt load up select list and gives errror that fun
Modules observable array contains simple js objects without observables so when accessing its properties you don't need to put ()
. Remove it from data.Id in selectPerson
function:
selectPerson = function(p){
selectedPerson(p);
editModuleId(ko.utils.arrayFirst(modules(), function (data) {
console.log("item module id " + p.ModuleId());
return data.Id === p.ModuleId();
}));
};
Here is working fiddle: http://jsfiddle.net/JUChh/3/
I look at your code closer and found that editModuleId
is redundant. You have needed property inside selectedPerson
object - ModuleId
and should bind value of dropdown to it.
Here is refactored fiddle: http://jsfiddle.net/JUChh/18/