:: Forum >>

Example or code for tooltip per cell on Beta 2?

Anyone have an Example or code for tooltip per cell on Beta 2.0?

In the old version I just did this......
/*************Add ToolTip*********/
var myColsTips = new Array();
for (var col=0; col < (myColumns.length); col++) {
obj.getTemplate("column",col).setAttribute("title", function(){return this.getProperty("column/text") + ": \'" + this.getProperty("item/tooltip") + "\'"});
obj.defineProperty("data/tooltip", function(i, col){return myData[i][col];});
}

obj.setProperty("column/tooltip", function(i){return myColsTips[i]});

/********************************/

Anthony
Monday, October 3, 2005
You can do similar thing with AW 2.0. However I just found what looks like a more clever way - adding tooltips dynamicaly on mouseover event. I think this approach is better because it does not affect initial rendering performance (each data request from the cell template is expensive).

obj.setCellTooltip(function(i, j){return j + "." + i});

    obj.onCellMouseOver = function(event, col, row){
        var e = this.getCellTemplate(col, row).element();
        var s = this.getCellTooltip(col, row);
        if (e) {
            e.setAttribute("title", s);
        }
        e = null;
    }


I am going to add this code in the beta2 so you will not need an event handler in the future, just set your tooltip text.
Alex (ActiveWidgets)
Monday, October 3, 2005
great, thanks!
Anthony
Monday, October 3, 2005

This topic is archived.


Back to support forum

Forum search