I have posted recently regarding select opgroup problems.
Turns out that select multiple when you use optgroup is completely broken AFAICS, it will not even render a basic template correctly.
No handlers, no code, no can-value or anything it renders a basic select optgroup incorrectly
this is stache templates using can.2.3.23.min.js
template as here —
<select name="{{fieldname}}" {{multiple}}>
  <option value="">-- choose --<option>
{{#each optgroups}}
  <optgroup label="{{label}}">
{{#each options}}
    <option value="{{value}}">{{label}}</option>
{{/each}}
  </optgroup>
{{/each}}
<select>
and can.Map({
  optgroups: [
    {label: ‘group one’,
    options: [
      {value= 1, label: ‘item one’},
      {value= 2, label: ‘item rwo’},
      {value= 3, label: ‘item three’}
  ]},
    {label: ‘group two’,
    options: [
      {value= 4 label: ‘item four’},
      {value= 5, label: ‘item five’},
      {value= 6, label: ‘item six’}
  ]}
})
will render with every option selected instead of nothing selected
AFAICS optgroup in single selects is fine
If I’m correct then this should be fixed as a matter of some urgency, if we cannot reliably render a template from given data then it’s game over.
If I’m wrong them I am more than happy for you to show me how and why
I don’t think I’m being stupid over this but …
Ron Yuen
