Get rid of predicates operator meni in header column when we have custom contol in filter column

I am trying to implement custom filter controls in some of my grid columns.

It would be a good idea to tell the column filter not to show a menu of operators (eg Equals, less then, etc.) when we already have a custom control.

You can check the samples on the official website

https://blazor.syncfusion.com/documentation/datagrid/filter-menu?cs-save-lang=1&cs-lang=razor#customizing-filter-menu-operators-list


https://blazor.syncfusion.com/documentation/datagrid/filter-menu?cs-save-lang=1&cs-lang=razor#filtering-using-daterangepicker


See that there is unnecessary and confusing to users predicates menu in column with custom control

Screenshot 2024-08-29 155234.png







1 Reply

NP Naveen Palanivel Syncfusion Team August 30, 2024 03:13 PM UTC

Hi Admir,

We reviewed your query and it seems that you want to hide the operator dropdown in the menu filter for a particular column when using a custom component in that column. You can achieve this requirement using CSS styles. Please refer to the code snippet and sample for reference.

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





                    TextAlign="TextAlign.Right" Width="120"></GridColumn>

    </GridColumns>

</SfGrid>

 

@if(flag == true)

{

    <style>

        .e-dialog .e-dlg-content .e-flm_optrdiv

        {

            display:none;

        }

       

    </style>

}

else if (flag == true)

{

    <style>

        .e-dialog .e-dlg-content .e-flm_optrdiv {

            display: block;

        }

    </style>

}

 

 

@code {

 

    public DateTime StartDate { get; set; }

    public DateTime EndDate { get; set; }

    public List<OrderData> GridData { get; set; }

    SfGrid<OrderData>? Grid { get; set; }

 

    bool flag = false;

 

    protected override void OnInitialized()

    {

        GridData = OrderData.GetAllRecords();

    }

    public void FilterDialogOpeningHandler(FilterDialogOpeningEventArgs args)

    {

        if (args.ColumnName == "OrderDate")

        {

            flag = true;

        }

        else

        {

            flag = false;

        }

    }



Regards,
Naveen 


Loader.
Up arrow icon