简体   繁体   中英

How do I show mouseover tooltip for header cell

I am stuck with using Dojo, so I must do it in the dojo way for this...

So I have this table, with the first row being the header row, and I want users be able to put their mouse on the header cells and a tooltip message would pop out.

So far this is my code:

onHeaderCellMouseOver: function(e){
    if(e.cellNode){
        var column = filt_grid.structFlat[e.cellIndex];
        if (column) {
            dijit.showTooltip('hello world', e.cellNode, 'before');
        }
        dojo.addClass(e.cellNode, this.cellOverClass);
    }
},

onHeaderCellMouseOut: function(e){
    if(e.cellNode){
        dijit.hideTooltip(e.cellNode);
        dojo.removeClass(e.cellNode, this.cellOverClass);
    }
}

With this code, it doesn't show tooltips, and on the Chrome debug console, it showed error message:

Uncaught TypeError: Cannot read property 'charAt' of undefined

Does anyone know what happened? I never used CharAT for the mouse hover...

What is the 'before' doing there? Delete the 'before' and it will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM