View Full Version : Multicombo show different field(s)

Oct 06, 2012, 4:19 PM
Not an isue, but an alternative for others which are looking for such option:
The idea is to show something like ShortName(LongName) in picker list, but to display only ShortName in edit field.

I wanted to avoid functions overwrite or too much javascript.

On short, add the below row in Show listener (ShortName have to be set as DisplayField in this example):

<Show Handler="var pick=this.getPicker(); var xhtml=this.picker.tpl.html; this.picker.tpl.html=xhtml.replace('{ShortName}',' {ShortName}({LongName})');" />

Of course, ShortName/LongName have to be valid record fields.
The default this.picker.tpl.html is the folowing:

<ul><tpl for="."><li role="option" class="x-boundlist-item"><div class="x-combo-list-item {[this.getItemClass(values)]}"><div class="x-mcombo-text">{displayField}</div></div></li></tpl></ul>
so, you can play with html a bit.

Didn't find breaks in functionality until now.

Oct 08, 2012, 9:36 AM
Hi @watteeuw,

Thank you for sharing! Looks very good.

Moved to the Examples and Extras forum.

We will look into a possibility to configure an inner template.

By the way, here is an example how to incorporate icons into the template.

Dec 17, 2012, 8:42 AM
Hi @watteeuw,

Now it is possible to set up the ListConfig.ItemTpl property. Here are more details.