ko.toJS()を使用してビューモデルから値(内部オブザーバブル)を投稿する計算されたオブザーバブルがあります。内部オブザーバブルの1つがテキストボックスにバインドされています。テキストボックスへの変更が計算されたオブザーバブル(つまりポストバック)を自動的にトリガーしないようにするにはどうすればよいですか?
function viewModel() {
var self = this;
self.SearchParams = {
OrderStatusID: ko.observable(),
OrderNumber: ko.observable(), // I don't want this observable to trigger the postback
OrderBy: ko.observable(),
OrderByDirection: ko.observable(),
PageIndex: ko.observable(),
PageSize: ko.observable()
};
// This computed observable automatically subscribes to every
// observable in self.SearchParams. How can I ignore changes to
// self.SearchParams.OrderNumber?
ko.computed(function () {
NS.post({
url: '/SomeUrl',
data: ko.toJS(self.SearchParams)
});
}).extend({ throttle: 1 });
}