[Dropdown] Disable specific options in dropdown programatically #1269
-
I apologize if this is covered somewhere in the documentation, but I can't find it. I have a modal which, when opened, changes a couple of things in the modal itself depending on which button is clicked. One of these things is a multiselect dropdown. This dropdown is full of documents assigned to a user (The button clicked determines which user the modal is loaded with details for). Some documents are assigned to users via different method, so I want to disable those documents in my dropdown. Is there any way to pass a list of document ID's to disable the option for in my dropdown? I could just use the The only information I can find about this online is for disabling the entire select box but this is not what I want. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
If you want to disable some entries of the dropdown, the specific item needs to have the {
"name" : "Choice 1",
"value" : "value1",
"disabled" : true
} |
Beta Was this translation helpful? Give feedback.
-
@lubber-de my trouble here is the dropdown is already created and initialized at this point, I just want to disable the already existing options. Are you saying I could do this with the Edit: It seems this behavior removes all of my options, I just want to disable specific ones. |
Beta Was this translation helpful? Give feedback.
-
If you have an identifier for the specific entry node you can just add the |
Beta Was this translation helpful? Give feedback.
-
This might work var myDesiredItem = $('.ui.dropdown').dropdown('get item','valueOfTheItem' );
myDesiredItem.addClass('disabled'); |
Beta Was this translation helpful? Give feedback.
-
Yeah, I got your idea to work, but I'm looping through a set of options like this:
|
Beta Was this translation helpful? Give feedback.
This might work