You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 choices, where choice is an object with the following structure:
{text: String,// requiredvalue: 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 modified_choice is an object with the following structure:
An alternative might be to simply use the value option of choices as either the value associated with the choice (if it's not a "group"), or the choices array (if it is a "group"), and have the choice's "group" status be dictated by another option on the choice object, say is_group: Boolean.
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.
The text was updated successfully, but these errors were encountered: