Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the filter icon in Ag-grid?

I'm trying to remove the filter icon in ag-grid whilst keeping the filtering box

Right now I'm trying to use pure css to hide the icon which in webpack just adds the aria-hidden="true"

CSS I've tried

* /deep/ div.ag-floating-filter-button{
    display:none !important;   
}

Trying to remove this icon

Icon

I either want to completely remove the grid icon using columnsAPI or find a way with CSS to disable the icon truely.

like image 557
Fueled By Coffee Avatar asked Jan 29 '18 21:01

Fueled By Coffee


People also ask

How do I remove filter icon?

Remove all the filters in a worksheet If you want to completely remove filters, go to the Data tab and click the Filter button, or use the keyboard shortcut Alt+D+F+F.

How do you turn on the filter on Ag grid?

The property can have one of the following values: boolean : Set to true to enable the default filter. The default is Text Filter for AG Grid Community and Set Filter for AG Grid Enterprise. string / Component : Provide a specific filter to use instead of the default filter.

How do I turn off sorting on Ag grid?

const gridOptions = { // enable sorting on all columns by default defaultColDef: { sortable: true }, columnDefs: [ { field: 'name' }, { field: 'age' }, // suppress sorting on address column { field: 'address', sortable: false }, ], // other grid options ... }

How do I change the filter model on Ag grid?

Get / Set All Filter Models It is possible to get the state of all filters using the grid API method getFilterModel() , and to set the state using setFilterModel() . These methods manage the filters states via the getModel() and setModel() methods of the individual filters.


2 Answers

Use floatingFilter and check floatingFilterComponentParams. You can hide the filter button by adding this in columnDefs in gridOptions like below

gridOptions = {
  floatingFilter: true
  columnDefs:[{
    ...
    suppressMenu: true,
    floatingFilterComponentParams: {suppressFilterButton:true}
    ...
  }]
}
like image 102
Ankit Avatar answered Oct 30 '22 15:10

Ankit


This page in the docs describes how to change the icons. I suggest that you change them to an empty string, either in the gridOptions or in a css file. here is the gridOptions way with a plunker:

<ag-grid-angular
    ...
    [icons]="icons"
    ...
    ></ag-grid-angular>


this.icons = {
  filter: ' '
}
like image 35
Jarod Moser Avatar answered Oct 30 '22 16:10

Jarod Moser