> [...]
> Hi there,
>
> I'm wondering if it is possible to attach a ToolTip to a cell in a
> table.
>
> I'm using qooxdoo 0.7.3
>
> Thanks,
>
> Romain
> [...]
Hi Romain,
this is what I used. It might not be the "cleanest" solution, but at least it
works ;) I stole the idea from the qx.ui.table.cellrenderer.Icon and
qx.ui.treevirtual.SimpleTreeDataCellRenderer.
I am quite sure that this is not the best solution, because it has some
disadvantages, too:
1) The selected cell does not display the tooltip.
2) Browser dependent maximal text length.
3) No "fancy" tooltips, just text.
But I would love to see some better solutions. As I said, this worked for my
purposes.
The only really interesting part is of cause the _getContentHtml method that
creates a HTML DIV-element containing the tooltip as "title"-attribute.
Regards,
Kuddel
P.S.: Still hoping to see a nice "works with qx.ui.popup.ToolTip" solution ;)
------------------------------------------------------
<code>
/**
* Cellrenderer to display user information (submitter)
*/
qx.Class.define("app.ui.table.cellrenderer.User",
{
extend : qx.ui.table.cellrenderer.Abstract,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
/**
* Creates one instance of this cellrenderer.
*
* @param formatCell {String?null} Format string for the cell.
* @param formatToolTip {String?"%5"} Format string for the tool tip.
*/
construct : function(formatCell, formatToolTip)
{
this.base(arguments);
this.__formatCell = new app.util.format.User(formatCell);
this.__formatTTip = new app.util.format.User(formatToolTip||"%5");
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members :
{
/** {app.util.format.User} */
__formatCell : null,
/** {app.util.format.User} */
__formatTTip : null,
// overridden
_getContentHtml : function (cellInfo)
{
var content = [
'<div title="', this.__formatTTip.format(cellInfo.value), '" >',
this.__formatCell.format(cellInfo.value),
"</div>" ];
return content.join("");
}
},
/*
*****************************************************************************
DESTRUCTOR
*****************************************************************************
*/
destruct : function ()
{
this._disposeObjects("__format", "__formatToolTip");
}
});
</code>
------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel