How to display message under comboBox dropdown

I created a comboBox,

var states = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data : [
        {"abbr":"AL", "name":"Alabama"},
        {"abbr":"AK", "name":"Alaska"},
        {"abbr":"AZ", "name":"Arizona"}
    ]
});

Ext.create('Ext.form.ComboBox', {
    fieldLabel: 'Choose State',
    store: states,
    queryMode: 'local',
    valueField: 'abbr',
    renderTo: Ext.getBody(),
    // Template for the dropdown menu.
    // Note the use of "x-boundlist-item" class,
    // this is required to make the items selectable.
    tpl: Ext.create('Ext.XTemplate',
        '<tpl for=".">',
            '<div class="x-boundlist-item">{abbr} - {name}</div>',
        '</tpl>'
    ),
    // template for the content inside text field
    displayTpl: Ext.create('Ext.XTemplate',
        '<tpl for=".">',
            '{abbr} - {name}',
        '</tpl>'
    )
});

      

below the dropdown I wanted to display some messages.

Can someone give an idea of ​​which component I will be using, or how to display the message below the dropdown. Please check the screenshot.

ScrrenShot

+3


source to share


1 answer


You can override renderTpl

in Ext.view.BoundList

, for example:

listConfig: {
            renderTpl: [
                '<div id="{id}-listWrap" data-ref="listWrap"',
                ' class="{baseCls}-list-ct ', Ext.dom.Element.unselectableCls, '">',
                '<ul id="{id}-listEl" data-ref="listEl" class="', Ext.baseCSSPrefix, 'list-plain"',
                '<tpl foreach="ariaAttributes"> {$}="{.}"</tpl>',
                '>',
                '</ul>',
                '<div style="border: solid 3px #000; padding: 2px;">Message</div>',
                '</div>',
                '{%',
                'var pagingToolbar=values.$comp.pagingToolbar;',
                'if (pagingToolbar) {',
                'Ext.DomHelper.generateMarkup(pagingToolbar.getRenderTree(), out);',
                '}',
                '%}', {
                    disableFormats: true
                }
            ],

        }

      



Working example: https://fiddle.sencha.com/#view/editor&fiddle/23g4

+3


source







All Articles