-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Specify widths on table columns to support long field names #17344
Conversation
@elastic/kibana-design Is it possible to solve this through CSS on the EUI side? It feels clunky to have to specify this manually, but if there is no better way, it's probably fine |
💚 Build Succeeded |
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.
This solution is a little brittle because we'll still get overlapping column content if the field name is long enough or if the screen is narrow enough.
I think @jen-huang's suggestion of adding word-break: break-word
is a great solution. Here's the layout I was able to achieve with some tweaks:
Here's how I edited the styles:
Here's the change I made to the code:
renderFieldName(name, isTimeField) {
return (
<Fragment>
{name}
{true ? (
<Fragment>
<EuiToolTip content="This field represents the time that events occurred.">
<EuiIcon type="clock" color="primary" />
</EuiToolTip>
</Fragment>
) : ''}
</Fragment>
);
}
/* ... */
const columns = [
{
field: 'displayName',
name: 'Name',
dataType: 'string',
sortable: true,
'data-test-subj': 'indexedFieldName',
render: (value) => {
return this.renderFieldName(value, indexPattern.timeFieldName === value);
},
width: '38%',
},
I adjusted the code a bit to get a better flow, and also fixed a mistake I made with renderFieldName(name, isTimeField) {
return (
<span data-test-subj="indexedFieldName">
{name}
{true ? (
<span>
<EuiToolTip content="This field represents the time that events occurred.">
<EuiIcon type="clock" color="primary" />
</EuiToolTip>
</span>
) : ''}
</span>
);
} |
PR updated to use EUI 0.0.34 which includes Also simplified the rendering functions as suggested and now passing |
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.
Looks great!
💔 Build Failed |
8a893d7
to
bfc67f1
Compare
💚 Build Succeeded |
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.
LGTM!
…17344) * Specify widths on table columns to support long field names
Fixes #17199
Manually specify table column widths to avoid long field names overlapping other columns.