Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
I am using select2:
http://select2.github.io/examples.html[^]

My example:
http://jsfiddle.net/2b0bod29/4/[^]

Now, how i can select "Book" item?
Select2 disable select parent, but i want to do it.
How do i can?

Sorry, my english very bad!
Posted
Comments
Kornfeld Eliyahu Peter 29-Jul-15 6:57am    
But 'Book' is not an item but a grouping...
GinCanhViet 29-Jul-15 9:55am    
So..can u help me? I want can select it, it has ID value. Any select drop can do it?
Kornfeld Eliyahu Peter 29-Jul-15 10:08am    
What I'm telling you that 'Book' is not an item, but a group and select2 does n not support the selection of groups (there was a debate around when someone asked for it as new feature but was dropped)...
So the only option is write some code for yourself to do so...
Suket shah 5-Aug-15 8:43am    
As it is group so why you need to select any specific result.It's just grouping an item.
GinCanhViet 17-Sep-15 9:02am    
if i want get ID of that group?

1 solution

I see one method in Select2 tree - JSFiddle - Code Playground[^]
but slow for large data
 
Share this answer
 
Comments
OriginalGriff 1-Jul-23 0:33am    
While I applaud your urge to help people, it's a good idea to stick to new questions, rather than 8 year old ones. After that amount of time, it's unlikely that the original poster is at all interested in the problem any more!
Answering old questions can be seen as rep-point hunting, which is a form of site abuse - and a vague "solution" like yours does make that look more likely. The more trigger happy amongst us will start the process of banning you from the site if you aren't careful. Stick to new questions and you'll be fine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900