In this view model I'm binding a drop down list with objects. when I want to clear the items from the drop downlist, I've provided selected item with "null" but it does clear the drop down but doesn't remove the selected Item. please see the fiddle. http://jsfiddle.net/aroor/Su8Zq/36/
<select data-bind="optionsCaption: ' ', options: stations, optionsText : 'name' ,value: selectedStation"> </select>
<button data-bind="click: clearSelectedStation">Clear</button>
<br>
<span data-bind='text : selectedStation().name'></span>
var ClearSelectionViewModel = function () {
var self = this;
self.station= ko.observable();
self.selectedStation = ko.observable();
self.stations = ko.observableArray([{name :'CLT'},{ name : 'PHL'},{ name :'PHX'},{ name :'PIT'}]);
self.clearSelectedStation = function () {
self.selectedStation(null);
};
};
ko.applyBindings(new ClearSelectionViewModel());