fix: pass through props for DataTableCell (DHIS2-15767) #1401
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.
Relates to DHIS2-15767
Required by dhis2/line-listing-app#427
Description
Background
Using a
Tooltip
in aDataTable
is currently quite tricky, as the table itself relies on a strict DOM structure ofDataTableBody
->DataTableRow
->DataTableCell
, so nothing else can easily be added into that structure. To wrap aTooltip
around an element without any additional side-effect elements the wrapped component (’DataTableCell) needs to implement a few props, such as ’onMouseOver’, ’onMouseOut’ and ’ref’. Currently the
DataTableCell` doesn't pass through the former two of these.Solution
DataTableCell
will now pass throughprops
to its underlyingTableCell
component, so that the props will be featured in e.g. thetd
of aTableDataCell
. This enables the use ofTooltip
.Example
Checklist
All points above should be relevant for feature PRs. For bugfixes, some points might not be relevant. In that case, just check them anyway to signal the work is done.
Screenshots