Skip to content

Commit 5a450ce

Browse files
committed
Fix issue with VariantTableWidget and x-data-grid filter panel alignment
1 parent aa00302 commit 5a450ce

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

jbrowse/src/client/JBrowse/VariantSearch/components/VariantTableWidget.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { observer } from 'mobx-react';
22
import {
33
DataGrid,
44
GridColDef,
5-
GridColumnVisibilityModel,
5+
GridColumnVisibilityModel, GridFilterPanel,
66
GridPaginationModel,
77
GridRenderCellParams,
88
GridSortDirection,
@@ -420,13 +420,26 @@ const VariantTableWidget = observer(props => {
420420
}
421421
}
422422

423+
// NOTE: the filterPanel/sx override is added to fix an issue where the grid column filter value input doesn't align with the field and operator inputs
423424
const gridElement = (
424425
<DataGrid
425426
columns={[...columns, actionsCol]}
426427
rows={features}
427428
density="comfortable"
428429
slots={{
429-
toolbar: ToolbarWithProps
430+
toolbar: ToolbarWithProps,
431+
filterPanel: GridFilterPanel
432+
}}
433+
slotProps={{
434+
filterPanel: {
435+
filterFormProps: {
436+
valueInputProps: {
437+
sx: {
438+
marginTop: 0
439+
}
440+
}
441+
}
442+
}
430443
}}
431444
columnVisibilityModel={columnVisibilityModel}
432445
pageSizeOptions={[10,25,50,100]}

jbrowse/src/client/JBrowse/VariantTable/components/VariantTableWidget.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ScopedCssBaseline from '@mui/material/ScopedCssBaseline';
88
import {
99
DataGrid,
1010
GridColDef,
11-
GridColumnVisibilityModel,
11+
GridColumnVisibilityModel, GridFilterPanel,
1212
GridPaginationModel,
1313
GridRenderCellParams,
1414
GridToolbar
@@ -352,10 +352,22 @@ const VariantTableWidget = observer(props => {
352352
}
353353

354354
const gridElement = (
355+
// NOTE: the filterPanel/sx override is added to fix an issue where the grid column filter value input doesn't align with the field and operator inputs
355356
<DataGrid
356357
columns={[...gridColumns, actionsCol]}
357358
rows={features.map((rawFeature, id) => rawFeatureToRow(rawFeature, id, gridColumns, trackId))}
358-
slots={{ toolbar: GridToolbar }}
359+
slots={{ toolbar: GridToolbar, filterPanel: GridFilterPanel }}
360+
slotProps={{
361+
filterPanel: {
362+
filterFormProps: {
363+
valueInputProps: {
364+
sx: {
365+
marginTop: 0
366+
}
367+
}
368+
}
369+
}
370+
}}
359371
pageSizeOptions={[10,25,50,100]}
360372
paginationModel={ pageSizeModel }
361373
onPaginationModelChange= {(newModel) => setPageSizeModel(newModel)}

0 commit comments

Comments
 (0)