feat: add multi-select filters and global search across data table rows [PR3] - #3721
Open
BRaimbault wants to merge 29 commits into
Open
BRaimbault wants to merge 29 commits into
BRaimbault wants to merge 29 commits into
Conversation
Contributor
|
🚀 Deployed on https://pr-3721.maps.netlify.dhis2.org |
…h useTableData Applies the global search after column filters and before selection filtering/sorting in the rows memo, matching case-insensitively across all string-typed columns.
Adds a Popover + checkbox-list path (reusing the pattern already established by TableContextMenu.jsx) rendered when an `options` prop is passed in. Option-set-backed columns get a separate wrapper component (OptionSetMultiSelectFilter) so useOptionSet/useDataQuery is only ever mounted when an optionSetId actually exists - legend/type columns never have one, and no test in the repo mocks useDataQuery.
Replaces the cryptic '2,>3&<8' placeholder with a simpler '> 5, < 8' and adds an info icon + Tooltip explaining the AND/OR/comparison syntax, consistent with Tooltip's existing use throughout DataTable.jsx/BottomPanel.jsx.
Table now forwards globalSearch into useTableData and threads columnOptions[dataKey]/optionSet.id from the header objects into FilterInput so it can pick between free-text and multi-select rendering.
Adds a dense Input between the "Clear filters" button and the show-only toggles, sized to shrink before the layer name has to truncate further. "Clear filters" now also resets the search box, and hasActiveFilters accounts for both column filters and the search string.
Threads an optional onItemClick/activeLegendNames pair through Legend -> LegendItem, scoped to THEMATIC_LAYER in OverlayCard (the only layer type with a legend data-table column). Clicking a legend class adds/removes it from the legend filter array and opens the data table for that layer if it isn't already showing. Other Legend call sites (plugin, download, edit preview, classification) never pass the new props, so they're unaffected.
Import order in FilterInput.spec.jsx and Prettier formatting across the files touched by the filtering changes.
…filtered, and a richer selection filter
Reverts c2b5aac. The thematic-only implementation is being pulled out of this PR - the feature should work across bubble, event, facility, and org-unit layers too, which needs its own investigation and belongs in a separate PR rather than this one.
Debounce the data table's global search so typing doesn't trigger a full re-filter on every keystroke, separating the input's own value from the debounced value passed to the table. Also clarify why useColumnWidths skips the header row's first cell (the fixed-width checkbox column).
The merge driver used to resolve en.pot's recurring timestamp-only rebase conflicts left message entries stale relative to the actual merged source (reordered/renamed strings weren't picked up). Re-run the extraction to bring it back in sync.
BRaimbault
force-pushed
the
feat/datatable-pr3-filtering
branch
from
September 10, 2026 12:49
44f7b5a to
02500a5
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part of DHIS2-21456
Description
Redesigns the data table's per-column filters into one unified multi-select widget, adds a global search box, and replaces the boolean "show only selected" toggle with a richer selected/not-selected filter. Third in the data table improvement series, building on PR1's toolbar and PR2's selection sync.
Column filters (
FilterInput)>/>=/</<=/,/&syntax); a help tooltip explains the numeric syntaxconstants/dataTable.js(SENTINEL_NO_VALUE,SENTINEL_ANY_VALUE,SENTINEL_SELECTED_ROW)Global search
filterByGlobalSearch), combined with column filters and the selection filterSelection filter (replaces the boolean "show only selected" toggle)
Layer.js'sgetVisibleIds)"Clear filters"
Toolbar polish
Resize handle
Context menu
Removed
indexfilter never matched any real feature)Refactors (no behavior change)
FilterInput.jsxsplit: dropdown-positioning logic →FilterDropdownPopover.jsx(also removes a cross-component dependency, sinceDataTable.jsxwas reaching intoFilterInput.jsx's internals for it); the sentinel-value toggle/reverse logic →util/filterSelection.js, now directly unit-testedDataTable.jsxsplit: column-width measurement/resize logic →useColumnWidths.js; row-selection bookkeeping →useRowSelection.jsuseTableData.js's sort/compare logic →util/tableSort.js, now directly unit-tested instead of only covered indirectly through the hookSORT_ASCENDING/SORT_DESCENDINGinconstants/dataTable.js;--colors-white/--elevations-popovercustom properties instead of hardcoded values in the datatable stylesheets)Bug fixes
data-testrenamed from-input-to-search-)mapStateToPropswhen no context menu is openQuality checklist
Add N/A to items that are not applicable.
Screenshots
supporting images