We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Enable/Disable Toolbar item in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

147751 Sep 23,2019 10:30 AM UTC Sep 24,2019 06:06 AM UTC Blazor 1
loading
Tags: Grid
Mr Andrey Voronov
Asked On September 23, 2019 10:30 AM UTC

ToolbarItem has no IsEnabled property

This "Add" item is displayed in toolbar, but it is always in disabled state: 

@{
var toolbaritems = new List<Syncfusion.EJ2.Blazor.Navigations.ItemModel>();
toolbaritems.Add(new Syncfusion.EJ2.Blazor.Navigations.ItemModel() { Text = "Add", TooltipText = "Add new claim", PrefixIcon = "e-add" });
}

<EjsGrid Toolbar="@toolbaritems"
<GridEvents TValue="DbGeneralOfficeClaim" ... OnToolbarClick="ToolbarClick"></GridEvents>



Vignesh Natarajan [Syncfusion]
Replied On September 24, 2019 06:06 AM UTC

Hi Andrey,  

Thanks for contacting Syncfusion support.  

Query: “This "Add" item is displayed in toolbar, but it is always in disabled state 
 
We are able to reproduce the similar behavior at our end too when preparing a sample using your code example. You have created custom toolbar item named “Add” which is similar to our inbuilt Toolbar item (used to perform insert operation in Grid). This (inbuilt Add) toolbar item will be enabled only when AllowAdding property of GridEditSettings is enabled, otherwise it will be in disabled.  

Since you have created the custom toolbar with similar name as inbuilt toolbar, it has been considered as inbuilt one and it is in disabled state. To overcome the reported behavior, we suggest you to define the Id property for toolbar items as below  

@{ 
     List<ItemModel> Toolbaritems = new List<Syncfusion.EJ2.Blazor.Navigations.ItemModel>(); 
    Toolbaritems.Add(new Syncfusion.EJ2.Blazor.Navigations.ItemModel() { Text = "Add", Id="add" , TooltipText = "Add new claim", PrefixIcon = "e-ad" }); 
} 

Note: if you want to perform default actions for this add button, you can enable AllowAdding property of  GridEditSettings.  

<EjsGrid DataSource="@Orders" @ref="Grid" AllowGrouping="true" AllowPaging="true" Height="200" Toolbar="Toolbaritems"> 
    <GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents> 
    <GridEditSettings AllowAdding="true"></GridEditSettings>  
.        .            .            .  
</EjsGrid> 
       
Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon