DropDown with disable item

Hello!

Is it posible in Dropdown disable some Item in the list? the idea is to show some items in dropdown but not selectable.

similar to:

<option value="-1" style="color:gray;" disabled="true">Option 4</option>

thank you!

regards

Not possible since the DropDown can create items only runtime based on provided Data unlike the select element where you can declare options manually.

@enchev ok, you are right,

One posible suggestion to code could be to add one new parameter DisabledProperty, as Dropdown have TextProperty, ValueProperty ?

TIA!

HI @enchev

I have tried to do it using <template/> but I can't do it work. I can do it in chrome developping tools adding class ui-dropdown-item-disabled to some <li/> item generated to test and it worked.

.ui-dropdown-item-disabled {
    pointer-events:none; //This makes it not clickable
    opacity:0.6;         //This grays it out to look disabled
}

So, Could you think about some easy posible change in RadzenDropDown to introduce this class or other solution in <li/> item generated during render?

I suggest you in past something about DisabledProperty o perhaps some posible solution with <template/>?

TIA!

1 Like

Hi Radzen Team!

Is there any way to disable/gray some item/s in DropDown?

thank you!

Check this thread: Selectively disable items on dropdown

Hi @korchev,

Thank you, I have tried the proposal of the thread that you have recommended and it does not work. I can't avoid clicking on disabled items.

it is necessary to add "pointer-events: none" in style of generated <li/> element to work.

thank you for you support!

I was pointing you to my reply in that thread - the one saying that this isn't supported.

thank you @korchev for your support!