Megabit / Blazorise

Blazorise is a component library built on top of Blazor with support for CSS frameworks like Bootstrap, Tailwind, Bulma, AntDesign, and Material.
https://blazorise.com/
Other
3.29k stars 532 forks source link

Disable item in DropdownList #5308

Closed raavikr12c closed 8 months ago

raavikr12c commented 8 months ago

Is there a way to disable specific items in dropdownlist? For example: I created a dropdownlist which has 3 options. If i click on one of the item some action will take place via my api and then that option should be disabled in the dropdownlist until i do some other action to enable it. Basically i want to communicate to user that you had already pressed this button and its action is done so you cannot repeat the action you just did by clicking on the same list item. I checked documentation but didn't find anything so asking it here. Also is there another way or a better way to achieve the same behavior i am looking for?

This is the code I am working with:

<TableRowCell>
    <Addons Style="background:inherit">
        <Addon AddonType="AddonType.Start">
            <Button>Items</Button>
        </Addon>
        <Addon AddonType="AddonType.Body">
            <DropdownList Data="@itemList"
                          TextField="@((item) => item.Description)"
                          ValueField="@((item) => item.ID)"
                          SelectedValue="@selectedItem"
                          SelectedValueChanged="@OnItemValueChanged"
                          TItem="Item"
                          TValue="object"
                          Direction="Direction.Up">
            </DropdownList>
        </Addon>
    </Addons>
</TableRowCell>
David-Moreira commented 8 months ago

Unfortunately the DropdownList does not support disabling specific items at this time. However the underlying Dropdown components do. So my recommendation for now is to create the Dropdown list manually by using the Dropdown DropdownToggle DropdownMenu And DropdownItem to create your dropdown list manually, and then control the disabled state in each of the DropdownItem.


We'll be considering this as a feature for the next release as it's relatively simple to implement. We'll be implementing a new Parameter similar to the ListView DisabledItem Func: image

raavikr12c commented 8 months ago

@David-Moreira thanks for the info. I will wait for this feature. Any expected date for 1.5 release?

David-Moreira commented 8 months ago

@David-Moreira thanks for the info. I will wait for this feature. Any expected date for 1.5 release?

I believe it's expected by the end of March. @stsrki ?

stsrki commented 8 months ago

Sometimes in March. We still have a few outstanding issues open.