Custom toolbars on DataGrid remain active after clicking.

Hello,


Custom toolbars on DataGrid remain active after clicking.

It's like a toggle button.

The built-in toolbar will return to its normal state, and I expect the custom toolbar to behave the same way.


You can surely reproduce this in BlazorDemo.

https://localhost:00000/datagrid/clipboard?theme=bootstrap4

Any help would be appreciated.


Regars,

Atsushi


Attachment: bandicam_20210721_143702984_ef606943.7z

3 Replies

JP Jeevakanth Palaniappan Syncfusion Team July 22, 2021 07:32 AM UTC

Hi Atsushi, 

Greetings from Syncfusion support. 

We have validated your query and we would like to inform you that by default, the clicked toolbar item will be in focus if the item is not re-rendered. This is the default behavior. we have prepared a sample to remove the focus after clicking the toolbar item. Please refer the below code snippet and the sample for your reference. 

<SfGrid ID="Grid" DataSource="@Orders" AllowPaging="true" Height="200" @ref="Grid" AllowGrouping="true" Toolbar="Toolbar"> 
    <GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents> 
 
@code{ 
    SfGrid<Order> Grid; 
    public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) 
    { 
        if (args.Item.Id == "copy" || args.Item.Id == "copyheader") { 
            await Grid.FocusAsync(); 
        } 
    } 
} 


Get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 



AS Atsushi Sugimoto July 22, 2021 09:52 AM UTC

Hi  Jeevakanth,


It worked exactly as I wanted it to!

Thank you for all your help.


Regards, 
Atsushi.




JP Jeevakanth Palaniappan Syncfusion Team July 23, 2021 04:17 AM UTC

Hi Atsushi, 
 
You are most welcome. Get back to us if you have any other queries. 
 
Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon