私は2つのエンティティで作業しています->タイプとドメインの両方がNumeroTypeを持っていることを望みます。
// MODEL TYPE
var TypeModel = function(data) {
var self = this;
this.Id = ko.observable();
this.NumeroType = ko.observable();
this.NomType = ko.observable();
ko.mapping.fromJS(data, {}, self);
};
// MODEL DOMAINE
var DomaineModel = function(data) {
var self = this;
this.Id = ko.observable();
this.NumeroType = ko.observable();
this.NumeroDomaine = ko.observable();
this.NomType = ko.observable();
ko.mapping.fromJS(data, {}, self);
};
すべてのドメーヌ ウィッシュを同じ NumeroType として選択ボックスに表示し、変更時にノックアウトしたいと考えています。非常に多くのことを試しましたが、うまくいきません...ノックアウトは初めてです...
<select name="NumeroType" id="NumeroType" data-bind="options: Type,
optionsText: 'NomType',
optionsValue: 'NumeroType',
value: NumeroType,
optionsCaption: '---- Type ----'">
</select>
<select name="NumeroDomaine" id="NumeroDomaine" data-bind="options: Domaine,
optionsText: 'NomType',
optionsValue: 'NumeroDomaine',
value: NumeroDomaine,
optionsCaption: '---- Domaine ----'">
</select>