DataGrid - ShowFilterBarStatus not working when EnablePersistence is true

Maybe it is a regression, see historic issue: https://www.syncfusion.com/forums/158639/grid-showfilterbarstatus-false-does-not-appear-to-work

I see the same behavior: the status bar in the pager shows the filters, even though I explicitly set ShowFilterBarStatus="false" ​on the GridFilterSettings. Apparently this is an issue when EnablePersistence="true" is set on the SfGrid.


3 Replies

SP Sarveswaran Palani Syncfusion Team February 13, 2024 01:29 AM UTC

Hi Peter,

Greetings from Syncfusion support.

Based on your query, it appears that when ShowFilterbarStatus is set to false, the filter bar values are still visible in the grid pager. We have created a sample based on your requirements, including the EnablePersistence property. However, we were unable to reproduce the reported issue on our end. Please refer to the attached code snippet and sample for your reference.

<SfGrid @ref="DefaultGrid" EnablePersistence="true" AllowFiltering="true" ID="Grid123" DataSource="@Orders" AllowSorting="true" AllowPaging="true">

    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.FilterBar" ShowFilterBarStatus="false"></GridFilterSettings>

    <GridColumns>

        .

        .

        .

   </GridColumns>

</SfGrid>


Sample: https://blazorplayground.syncfusion.com/embed/hjLzDVCBTGQdWiVO?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

If still issue persists, kindly share the following details to us.


  1. Mentioned issue occurs in which version?
  2. Share the video demo of an issue.
  3. Share the grid code snippet and issue reproducible sample to us.
  4. If possible, reproduce a reported issue in the provided sample.


Above requested details help us to further validate your query and provide precise solution ASAP from our end.

Regards,
Sarvesh




PE Peter February 13, 2024 06:46 AM UTC

Hi Sarvesh,

thank you for your support, this helped me identify the root cause. Here is what I found to reproduce the issue:

  • First, enable filter bar status: ShowFilterBarStatus="true"
  • Run app and enter any search value into a search field
  • Close app and disable filter bar status: ShowFilterBarStatus="false"
  • Run app and see that the filter is always displayed in the status bar
So the issue seems to be that if it was enabled before, then the persisted setting in the local storage of overrides what is actually set in the grid.



SP Sarveswaran Palani Syncfusion Team February 15, 2024 11:22 AM UTC

Hi Peter,

We want to inform you that when using the enablePersistence property, the grid maintains local browser storage. Consequently, if you re-render the grid with ShowfilterBarStatus set to false, it will retrieve the values from local storage again. If you need to clear the local storage, we recommend using our built-in method ResetPersistDataAsync. This method clears the local storage and refreshes the grid. For your convenience, we have attached a sample and code snippet for reference.

<SfButton OnClick="FilterStatus">Filter Status</SfButton>

 

<SfGrid @ref="DefaultGrid" EnablePersistence="true" AllowFiltering="true" ID="Grid123" DataSource="@Orders" AllowSorting="true" AllowPaging="true">

    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.FilterBar" ShowFilterBarStatus="@filterstatus"></GridFilterSettings>

    <GridColumns>

        .

        .

        .

   </GridColumns>

</SfGrid>

@code {

    private SfGrid<OrderData> DefaultGrid;

 

    public bool filterstatus = false;

 

    public void FilterStatus()

    {

        filterstatus = !filterstatus;

        if (!filterstatus)

        {

            DefaultGrid.ResetPersistDataAsync();

        }

    }

}


Reference: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_ResetPersistDataAsync

Sample: https://blazorplayground.syncfusion.com/embed/BDrzZrMyqcHtWDiS?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

If you have any further queries, please get back to us.

Regards,
Sarvesh


Loader.
Up arrow icon