Issue with adding tooltip for header columns
Hello, I am using react data grid to show data on my web page. I am using row selection, filter and sorting options. I have about 55 to 60 fields/columns that I need to display on the grid. To minimize the size of columns I have resized few columns to be short so, some of the names of header columns are being cut off. I would like to show a tooltip for the header columns so that users know the full column name when they hover on it. Please share the property name if its available in react data grid or please provide me options on how to achieve this.
Which version of React JS are you using?
react: 15.6.2, react-data-grid: 3.0.11
Hey @naindla, did you find an answer to your question ? I'm interested as well
Hello @naindla, I also need a fix for this.
Try set headerRenderer for the column. https://adazzle.github.io/react-data-grid/docs/ReactDataGrid#selectallrenderer
@yunhan Any working example? I am using v5.0.1
I tried below code but it is leading to error.
headerRenderer: ({ value }) => <span title={value}>{value}</span>
Getting below error
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Hi @monish001 My code is like this:
const HeaderFormatter = (value) => {
return <span title={value.column.name}>{value.column.name}</span>
};
let new_col = {key: itemNo, name: cols[itemNo].Header};
new_col['headerRenderer'] = HeaderFormatter;
Hope it helps!
Thanks @yunhan for the response. But your approach not working for me in [email protected]. Which version are you using?
Below is the stack trace of error i am getting
The above error occurred in the <div> component:
in div (created by SortableHeaderCell)
in SortableHeaderCell (created by HeaderRow)
in div (created by HeaderCell)
in HeaderCell (created by HeaderRow)
in div (created by HeaderRow)
in div (created by HeaderRow)
in HeaderRow (created by Header)
in div (created by Header)
in Header (created by Grid)
in div (created by Grid)
in Grid (created by ReactDataGrid)
in div (created by ReactDataGrid)
in div (created by ReactDataGrid)