Ability to Disable DropDownButtonItem within EjsDropDownButton

It would be useful to have the ability to disable a DropDownButtonItem.

<DropDownButtonItem Disabled=true Text="Option 1"></DropDownButtonItem>

3 Replies

SD Saranya Dhayalan Syncfusion Team March 12, 2020 07:03 AM UTC

Hi Robert, 
 
Thank you for contacting Syncfusion support 
 
Query: It would be useful to have the ability to disable a DropDownButtonItem. 
 
We have checked your reported query, you can achieve this by using beforeItemRender event. In this event you can add the “e-disabled” class for the specified item. Please find the below code snippet: 
 
@using Syncfusion.EJ2.Blazor.SplitButtons 
 
<EjsDropDownButton Content="Edit"> 
    <DropDownButtonEvents OnItemRender="BeforeItemRender"></DropDownButtonEvents> 
    <DropDownButtonItems> 
        <DropDownButtonItem Text="Cut"></DropDownButtonItem> 
        <DropDownButtonItem Text="Copy"></DropDownButtonItem> 
        <DropDownButtonItem Text="Paste"></DropDownButtonItem> 
    </DropDownButtonItems> 
</EjsDropDownButton> 
 
@code  { 
 
    private void BeforeItemRender(Syncfusion.EJ2.Blazor.SplitButtons.MenuEventArgs args) 
    { 
        if (args.Item.Text == "Cut") 
        { 
            args.Element.AddClass(new string[] { "e-disabled" }); 
        } 
    } 
} 
 
For your convenience we have prepared a sample. Please find the below sample link. 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Saranya D 



RO Robert March 12, 2020 01:36 PM UTC

Thank you, this has worked.


SD Saranya Dhayalan Syncfusion Team March 12, 2020 01:39 PM UTC

Hi Robert, 
 
Most Welcome… 
 
We are happy to hear that your requirement has been fulfilled. Kindly get back to us if you need any further assistance. 
 
Regards, 
Saranya D 


Loader.
Up arrow icon