View Full Version : Auto ToolTip width for ComboBox list items using HTML/JS Template

21 Aug 2009, 9:36 PM
Appropriately so, tooltips auto size based on the dimensions of the underlying data they're showing. However, this is limited up to 300 pixels.

When using a ComboBox.setTemplate(), and setting the qtip attribute in the provided template, I'd like to be able to increase the limit from 300 pixels to a known larger value.

I've tried many variations of the following :
- QuickTip(comboBox)
- qwidth=auto (in the Template)
- comboBox.getToolTip().setMaxWidth()
- qwidth=values.width+10 (in the Template)
- parent.width (in the Template)

Here's some sample code for context:

comboBox.setTemplate( getTemplate() );

private native String getTemplate()
return [
'<tpl for=".">',
'<table class="search-item"',
' qtip="',
'<table class=\'tooltip-item\'>',
'<td class=\'padded\'><b>RAM:</b></td><td>{memSize}</td>',
'<td class=\'padded\'><b>Disk Size:</b></td><td>{osDiskSize}</td>',
'<td class=\'padded\'><b>Paravirtualized:</b></td><td>{paraVirtualized}</td>',
' style="width:100%"',
'<td style="width:20%"><b>{name}</b></td>',
'<td style="width:60%">{description}</td>',
'<td style="width:20%">{vmTechnology}</td>',
Of course, I can set the qwidth="800", but that defeats the benefit of the auto-sizing. For example, it's really dumb to have a 4" tooltip when all you're showing is "Hello". The bottom line, is I want qmaxwidth and qminwidth values ...and continue to allow the auto-sizing to size within those constraints. Even if these attributes (or something like them) are not available, I'd be equally happy if I could do this somehow in the java source code.

24 Aug 2009, 1:07 AM
dublicate posting of:
"Auto-sizing ToolTips for list items using Template qtip"