I have two select list . And I use ko.utils.arrayFilter method to change my select list.
Everything is good when i use it to do “Add Field” or “Remove Field”.
But when i changed the viewmodel,then i click the “Add Field” or “Remove Field” the select list won’t update correctly.
self.test = function(){
var idx = self.rightSeleted();
var selectedField = $.grep(self.availableFields(), function(n, i){
return n.FieldNameId == idx;
});
debugger;
var currentValue = selectedField[0].IsAsc();
};
my sample code is in here http://jsfiddle.net/knupA/
Did i do something wrong when bindding select list ?!
Thanks~
I’ve updated your jsFiddle, and it seems to work. I changed your method to select from the arrays to use the Knockout method, and I removed your test method, as that was being called when nothing in the right dropdown was selected, so was blowing up.