How to refresh GRID Header or GRID Toolbar without refreshing whole data in Blazor DataGrid?

Hello !
I am using a Syncfusion Grid with a toolbar.
Based on some variables I enable or disable a few buttons from the toolbar on rowselect/rowdeselect grid event.
I tried to call statehaschanged method from  rowselect/rowdeselect grid event but no success.

If I call Refresh method it is working but it is taking too much time because the whole grid is refreshed...
Please tell me how can I refresh only the grid header or the toolbar of the grid !
I have seen there is a property called SoftRefresh but I don't know how to use it...

Thank You !


1 Reply 1 reply marked as answer

MS Monisha Saravanan Syncfusion Team March 21, 2022 01:36 PM UTC

Hi Tom, 

Greetings from Syncfusion support. 

We have analyzed your query and we suspect that you are trying to Enable/Disable the toolbar on performing RowSelect/ Deselect. So we suggest you to use our inbuilt method EnableToolbarItems method to enable or disable the toolbar items. Kindly refer the attached code snippet and reference for additional information. 

 
@{ 
    var Tool = (new string[] { "Expand", "Collapse" }); 
} 
<SfGrid id="Grid" DataSource="@Orders" AllowPaging="true" Height="200" @ref="Grid" AllowGrouping="true" Toolbar=@Tool> 
 
    
    <GridEvents OnToolbarClick="ToolbarClickHandler" RowSelected="Selected" RowDeselected=DeSelected TValue="Order"></GridEvents> 
    <GridColumns> 
        ... 
   </GridColumns> 
</SfGrid> 
 
@code{ 
 
 
    public async Task Selected(RowSelectEventArgs<Order> args) 
    { 
         await this.Grid.EnableToolbarItems(new List<string>() { "Grid_Expand", "Grid_Collapse" }, true); 
 
    } 
    public async void DeSelected(RowDeselectEventArgs<Order> args) 
    { 
        await this.Grid.EnableToolbarItems(new List<string>() { "Grid_Expand", "Grid_Collapse" }, false); 
 
    } 
     
 
    } 



Kindly get back to us if we misunderstood your query or if you have further queries. 

Regards, 
Monisha 


Marked as answer
Loader.
Up arrow icon