gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

Select optgroups #135

Closed danielkay closed 3 years ago

danielkay commented 8 years ago

if the 'values' key exists when looping through the options array, then we can assume that 'label' refers to the label of an optgroup. Thereby the following structure will map to a select menu with optgroups:

[
  {label: "Option One", value: "option1"},
  {
    label: "OptGroup One",
    values: [
      {label: "Option Two", value: "option2"},
      {label: "Option Three", value: "option3"}
    ]
  },
  {
    label: "OptGroup Two",
    values: [
      {label: "Option Four", value: "option4"},
      {label: "Option Five", value: "option5"}
    ]
  },
  {label: "Option Six", value: "option6"},
]