Knockoutjs 选择带选项组 [英] Knockoutjs select with option group
本文介绍了Knockoutjs 选择带选项组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Knockoutjs 绑定中有什么方法可以指定 optionsGroup 吗?类似以下内容
Is there any way in Knockoutjs binding where I can specify optionsGroup ? something like follwoing
<select data-bind="options: collection, optionsText: 'Text', optionsGroup: 'Group'/>
请回复.
推荐答案
我得到了同样的答案,如果有人想要,这里是答案,
I got the answer of the same, here is the answer if anybody wants,
<td><select class="fieldValue" data-bind="foreach: $root.AvailableFields, value: FieldId, event :{ change: $root.onFieldSelectionChange}">
<optgroup data-bind="attr: {label: FieldGroupName}, foreach: Fields">
<option data-bind="text: HeaderText, value: FieldId"></option>
</optgroup>
</select>
</td>
这篇关于Knockoutjs 选择带选项组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文