1
昨天經過大量的幫助後,我採用了示例車的示例,並將其應用到我的應用(搜索B & B房間)。KnockoutJS自定義數據綁定添加移動樣式
的想法是,你從(1)房型選擇 - 這再填充(2)住戶 - 當你再從(2)住戶選擇,它填充(3)數REQD
問題是我不能讓它移動樣式添加到新添加的下拉列表中,一旦居住者的數量已選擇:
有一個工作搗鼓在這裏:http://jsfiddle.net/mtait/g8cQz/5/
隨着@丹幫助 - 他得到了聖yling被應用到乘客下拉列表中,通過添加jqmOptions: sampleProductCategories
:
<td>
<select data-bind='jqmOptions: sampleProductCategories, options: $root.RoomCategories, optionsText: "TypeName", optionsCaption: "Select...", value: category'></select>
</td>
<td data-bind="with: category">
<select data-bind='jqmOptions: sampleProductCategories, options: Occs, optionsText: "occdesc2", optionsCaption: "Select...", value: $parent.occupancy'></select>
</td>
<td class='quantity' data-bind="with: category">
<select data-bind="visible: $parent.occupancy, options: ko.utils.range(0, TypeCount), value: $parent.quantity"></select>
</td>
ko.bindingHandlers.jqmOptions = {
update: function (element, valueAccessor, allBindingsAccessor, context) {
ko.bindingHandlers.options.update(element, valueAccessor, allBindingsAccessor, context);
$(element).selectmenu();
$(element).selectmenu("refresh", true);
}
};
什麼我需要REQD,當選擇乘員增加,以獲得所需數量下拉列表或佔用下拉列表中,以添加樣式的數量?
謝謝
馬克
喜@Anders更新 - 謝謝 - 我已經更新了小提琴http://jsfiddle.net/mtait/g8cQz/6/,但它現在顯示在選擇乘員之前要求的號碼 - 它也改變了乘客的初始下拉和所需的號碼[對象:對象] - 謝謝,馬克 – Mark