Skip to content
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

optgroup order? #499

Closed
joshuataylor opened this issue Jul 3, 2014 · 5 comments
Closed

optgroup order? #499

joshuataylor opened this issue Jul 3, 2014 · 5 comments

Comments

@joshuataylor
Copy link

Is it possible to order multiple optgroups?

Let's say I have fruits and vegetables, would it be possible to put fruits above vegetables?

@NotSqrt
Copy link

NotSqrt commented Jul 30, 2014

There's an option called ''optgroupOrder'' for this.

brianreavis added a commit that referenced this issue Jan 30, 2015
#640, #381, #499, #198).

Deprecates optgroupOrder, introduces lockOptgroupOrder setting.
@brianreavis
Copy link
Member

This has changed a little in 0.12.0. Now, set the $order property on each item in your optgroups array.

@shurfee
Copy link

shurfee commented Dec 12, 2016

@brianreavis, could you please give an example how to implement your advice?

I need to sort optgroups by its labels, is it possible?

In my "options" code for selectize there is a key sortField with a value of "text". But it sorts only options by its inner text.
And I need to sort not only options inside optgroup, but also optgroups themselves.

<optgroup label="1"> <option>Text ABC</option> </optgroup>
<optgroup label="2"> <option>Text BCD</option> </optgroup>

@adamgins
Copy link

adamgins commented Aug 10, 2017

@brianreavis thanks for the great package. I am using 0.12.1_5

can't seem to get it to pick up the $order, I have optgroups: [{$order: 1, group:'role',name:'Role'}, {$order: 2,group:'team',name:'Team'}, {$order: 3,group:'people',name: 'Participants'}]

but it renders in the wrong order. I tried changing the numbering, in reverse... no luck I see items in this order Participants, Team, People regardless of the $order param/val

update: I upgraded to 0.12.4 , same issue

@brjadams
Copy link

@adamgins had the same issue. Saw the optgroup examples from selectize, where the added the 'lockOptgroupOrder' flag. Seems to fix it. I'm using 0.12.1.

Just add 'lockOptgroupOrder: true' to your selectize options on initialize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants