Search code examples
sencha-touchsencha-touch-2

Add more than a field in selectfield displayvalue (Sencha Touch 2)


I have the following select field :

{
    xtype: 'selectfield',
    name: 'sourcecurrency',
    label: 'Source Currency',
    valueField: 'name',
    displayField: '{name} - {description}',
    store: 'Countries',
    placeHolder: 'Select your source currency'
},

The data is returning two fields 'name' and 'description'; I want to display the two fields in the select area, setting the displayField as shown works but i still have the '{}' surrounding them.

Must be really damn stupid but can't figure it out.


Solution

  • There's no direct way of showing more than one field in selectfield's displayField.

    So, you will need to create an extension based on the selectfield.