PDA

View Full Version : Combobox: why isn't display value rendered using XTemplate?



wump
10 Oct 2010, 6:05 AM
I have added a Combobox sourced from a JSONStore to my layout, and provided a 'tpl' (XTemplate) to render the options with icons and special style based on multiple fields.

This works great when the list is shown, but when selecting a value the field reverts to simply displaying the displayField in plain old text.

Is there a way to change this behavior?

plalx
10 Oct 2010, 7:02 AM
Yes, you will have to create a costum class for this. There is an example on how you can achieve this here (http://www.sencha.com/learn/Tutorial:Extending_Ext_Class). There are several ways of doing this, but looking at this extension will help you. I suggest that you also override the assertValue method.

wump
10 Oct 2010, 7:13 AM
Thank for pointing me in the right way, I'll take a look at those examples.