我正在使用2个实体 - > Type和Domaine希望两者都有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);
};
我希望在我的选择框中显示所有Domaine的愿望,因为相同的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>