Another tough one to track down this.

In our combobox class we use onBindStore to perform some processing.

One of these is adding an empty item to the store if allowBlank is true (and we've been configured to do so). Another is automatically selecting an entry in the store if it only has one record and we have no value (and we've been configured to do so).


These often involve a call to getValue, and that explodes since calls getDisplayValue which requires a displayTpl, which is set up after the bindStore call.


So, what I need is for the displayTpl to be set up before bindStore is called.


My current override:



Code:



/**
* Override to ensure displayTpl is set up before bindStore is called.
*/
initComponent: function() {
var me = this,
displayTpl = me.displayTpl;


if (!displayTpl) {
me.displayTpl = new Ext.XTemplate(
'<tpl for=".">' +
'{[typeof values === "string" ? values : values["' + me.displayField + '"]]}' +
'<tpl if="xindex < xcount">' + me.delimiter + '</tpl>' +
'</tpl>'
);
} else if (!displayTpl.isTemplate) {
me.displayTpl = new Ext.XTemplate(displayTpl);
}


me.callParent(arguments);
}

Thoughts?

Cheers,

Westy