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. Image for the cookie policy date

Disable filtering on one column in Grid

Good day,

I have five columns in Grid. I am filtering the columns using an API, but I want to disable filtration on one of the columns in the grid. Like there should be no filtration textbox showing for this column in the Grid.

How can I do that?

Thanks.

3 Replies

VN Vignesh Natarajan Syncfusion Team November 22, 2019 09:12 AM UTC

Hi Junaid,  

Thanks for contacting Syncfusion forums.  

Query: “I want to disable filtration on one of the columns in the grid 
 
We can disable filtering for particular column using AllowFiltering property of GridColumn. Refer the below code example.  

<EjsGrid DataSource="@Orders" AllowFiltering="true" AllowPaging="true"> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Order.OrderDate) AllowFiltering="false" HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"> 
        </GridColumn> 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</EjsGrid> 

Also refer our UG documentation for your reference 



Query: “Like there should be no filtration textbox showing for this column in the Grid. 

By default when we disable filtering for particular column, its filter bar (input box) will be disabled. You can achieve this requirement using these methods 1. By changing the FilterType or 2. Using FilterbarTemplate.  
 
  1. Using FilterBarTemplate.

You can define the empty FilterTemplate for that particular column, if you want to remove the default filter bar. Refer the below code example.  

<EjsGrid DataSource="@Orders" AllowFiltering="true" AllowPaging="true"> 
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Order.OrderDate) AllowFiltering="false" HeaderText=" Order Date" Format="yMd" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"> 
            <FilterTemplate></FilterTemplate> 
        </GridColumn> 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</EjsGrid> 

Also refer our UG documentation for your reference 


  1. By Changing the Filter type as Excel / Menu.

Refer our UG documentation for your reference 



Please get back to us if you have further queries.  

Regards, 
Vignesh Natarajan. 



JU Junaid November 28, 2019 11:58 AM UTC

Thanks. That helped!!

Regards
Junaid


VN Vignesh Natarajan Syncfusion Team November 29, 2019 03:46 AM UTC

Hi Junaid,  

Thanks for the update.  

We are glad to hear that your query has been resolved by our solution. 

Please get back to us if you have further queries. 

Regards, 
Vignesh Natarajan.   



Loader.
Live Chat Icon For mobile
Up arrow icon