react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Issue with adding tooltip for header columns

Open naindla-zz opened this issue 8 years ago • 6 comments

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

naindla-zz avatar Jun 01 '18 04:06 naindla-zz

Hey @naindla, did you find an answer to your question ? I'm interested as well

Antonhansel avatar Aug 30 '18 17:08 Antonhansel

Hello @naindla, I also need a fix for this.

monish001 avatar Dec 26 '18 04:12 monish001

Try set headerRenderer for the column. https://adazzle.github.io/react-data-grid/docs/ReactDataGrid#selectallrenderer

yunhan avatar Apr 19 '19 19:04 yunhan

@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.

monish001 avatar Jun 18 '19 20:06 monish001

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!

yunhan avatar Jun 20 '19 12:06 yunhan

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)

monish001 avatar Jun 27 '19 18:06 monish001