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
I either want to completely remove the grid icon using columnsAPI
or find a way with CSS to disable the icon truely.
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.
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.
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 ... }
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.
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}
...
}]
}
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: ' '
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With