Skip to content

Commit

Permalink
multi filter
Browse files Browse the repository at this point in the history
  • Loading branch information
juberti committed Apr 22, 2024
1 parent 9425804 commit 660e770
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions website/src/components/DataGrid.astro
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ import 'ag-grid-community/styles/ag-theme-quartz.css';
const gridDiv = document.querySelector("#myGrid") as HTMLElement;
const gridOptions = gridOptionsBase;
const isMobile = window.matchMedia('(max-width: 640px)').matches;
const providerFilter = urlParams.get('pf');
const modelFilter = urlParams.get('mf');

// remove TTFT and TPS columns on mobile
if (isMobile) {
gridOptions.columnDefs.splice(2, 2);
Expand All @@ -139,10 +141,14 @@ import 'ag-grid-community/styles/ag-theme-quartz.css';
});
// create the grid and set the filter if needed
gridApi = createGrid(gridDiv, gridOptions);
let filter = {};
if (providerFilter) {
filter.provider = { filterType: 'text', type: 'contains', filter: providerFilter };
}
if (modelFilter) {
const filter = { model: { filterType: 'text', type: 'contains', filter: modelFilter }}
gridApi.setFilterModel(filter);
}
filter.model = { filterType: 'text', type: 'contains', filter: modelFilter };
}
gridApi.setFilterModel(filter);
// set the selected region and populate the grid
const selectedRegionRadio = document.querySelector(`input[name=selectedRegion][value=${selectedRegion}]`) as HTMLInputElement;
selectedRegionRadio.checked = true;
Expand Down

0 comments on commit 660e770

Please sign in to comment.