PDA

View Full Version : Combobox list generated via tpl doesn't highlight the first item



shin0135
14 May 2013, 4:04 AM
Hi,

For some reason, the combobox generated with xtemplate tpl doesn't highlight the first item automatically. I think that's the default behavior. Isn't it? Is there a way to programmatically highlight and select the first item by default so that when a user uses the enter key it gets selected as mouse click on the first item?

Another question related is how to detect the tpl is rendered completely. Is there an event I could listen on?

The combobox has the typeAhead attribute false and selectOnFocus true.
Here is how the xtemplate looks like



var addressTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="x-combo-list-item" style="border-bottom: 1px solid #BDCEE4;">',
'<table width="100%" cellpadding="0" cellspacing="0">',
'<tr>',
'<td><b>{name}</b></td>',
'</tr>',
'<tr>',
'<td>{[this.formatAddress(values)]}</td>',
'</tr>',
'</table>',
'</div>',
'</tpl>',
{ formatAddress: function(rec) {.....}};




By the way, I'm using ExtJS 3.2 and currently there is no plan to upgrade to any other versions.

Thanks!

shin0135
16 May 2013, 4:29 AM
Another question related is how to detect the tpl is rendered completely. Is there an event I could listen on?


Does anyone have a solution for this? Specifically, I'd like to know a way of finding out when the combo box is expanded with data generated in xtemplate.

Well, my main goal is to select/focus the first item on the list generated via tpl after the list is rendered and expanded.