PDA

View Full Version : Multicombo show different field(s)



watteeuw
Oct 06, 2012, 3: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.

Daniil
Oct 08, 2012, 8: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.
http://forums.ext.net/showthread.php?21350&p=92433&viewfull=1#post92433

Daniil
Dec 17, 2012, 7:42 AM
Hi @watteeuw,

Now it is possible to set up the ListConfig.ItemTpl property. Here are more details.
http://forums.ext.net/showthread.php?21350&p=98715&viewfull=1#post98715