-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(table): add custom input to header columns #3767
base: 2.x.x
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1034,4 +1034,16 @@ describe('FilterHeaderRow', () => { | |
expect(screen.getByTestId('filter-row-icon')).toBeVisible(); | ||
}); | ||
}); | ||
|
||
it('should display custom input when not undefined', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add a test where we use the custom input to ensure that we are able to filter data in the table. |
||
render( | ||
<FilterHeaderRow | ||
{...commonFilterProps} | ||
ordering={[{ columnId: 'col1' }, { columnId: 'col2' }]} | ||
columns={[{ id: 'col1', customInput: 'customInput' }, { id: 'col2' }]} | ||
EKong-IBM marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
); | ||
|
||
expect(screen.getAllByText('customInput')[0]).toBeInTheDocument(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -669,6 +669,7 @@ const TableHead = ({ | |||||
isFilterable: !isNil(column.filter), | ||||||
isMultiselect: column.filter?.isMultiselect, | ||||||
width: column.width, | ||||||
customInput: column?.customInput, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would imagine we would want this to be part of the filter object. Like above on line 670, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok that seems to have worked. Thanks 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}))} | ||||||
hasFastFilter={hasFastFilter} | ||||||
clearFilterText={clearFilterText} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we need this to be an
elementType
so we can pass in a ref.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to define an onChange handler in the filter object.
OR,
If we keep as an
element
we can clone the component and add the ref that way. That may be preferable.