-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "optgroups" #8
Comments
Hmm. Interesting idea, and it could be super useful, but we should think about the implementation a little bit. Maybe something like this: $(selector).immybox({
choices: [
{text: 'An ungrouped choice', value: 'something'},
{text: 'A group', choices: [
{text: 'A grouped choice', value: 'something_else'},
...
]}
...
}); Formally, the choices initialization option can only be an array of {
text: String, // required
value: Object, // optional; if missing, choice is a "group"
choices: Array // optional; ignored if choice is not a "group"; if choice is a "group", elements of this array must be modified_choice elements
} and {
text: String, // required
value: Object, // required
} An alternative might be to simply use the Yet another approach would be to use two different initialization options, e.g.: $(selector).immybox({
groups: [
{text: 'A Group', value: 'some_group'}
],
choices: [
{text: 'An ungrouped choice', value: 'something'},
{text: 'A grouped choice', value: 'something_else', group_value: 'some_group'}
...
}); That option would be the cleanest to use, IMO, but the most difficult to implement since it would require parsing the choices into groups. |
I like the last option the most as well but it is definitely a little more involved to implement. |
The text was updated successfully, but these errors were encountered: