Is there any way in Knockoutjs binding where I can specify optionsGroup ? something like follwoing
<select data-bind="options: collection, optionsText: 'Text', optionsGroup: 'Group'/>
Please do reply.
Is there any way in Knockoutjs binding where I can specify optionsGroup ? something like follwoing
<select data-bind="options: collection, optionsText: 'Text', optionsGroup: 'Group'/>
Please do reply.
This will also allow a placeholder:
JS would be in this format:
This option value, could be value in this simple instance.
But for more complex object $data would be the better option.
I got the answer of the same, here is the answer if anybody wants,
In many cases, you don't need the options themselves to be observable, just the result of the selection. Here is the example which does UK county selection.
HTML:
JS :
You will retrieve the selected option in viewModel.countyList.
Try this.
jsfiddle
source