PDA

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



pclemons
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\'>',
'<tr>',
'<td><b>CPU:</b></td><td>{numberOfCPUs}&nbsp;-&nbsp;{cpuArchitecture}</td>',
'<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>',
'</tr>',
'</table>',
'"',
' style="width:100%"',
'>',
'<tr>',
'<td style="width:20%"><b>{name}</b></td>',
'<td style="width:60%">{description}</td>',
'<td style="width:20%">{vmTechnology}</td>',
'</tr>',
'</table>',
'</tpl>'
].join("");
}-*/;
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.

Arno.Nyhm
24 Aug 2009, 1:07 AM
dublicate posting of:
"Auto-sizing ToolTips for list items using Template qtip"
http://extjs.net/forum/showthread.php?p=377753