-2

I'm new to ExtJs and currently working on ExtJs5 for one scenario.

Below is the code for combo box. visible value in the combobox is "tr" and i need to pass the value to the store to get the report dashboard (table) and to display in below. how to do i access the report item id within the combobox?

{
  xtype: 'combo', 
  fieldLabel: LANG.LOGIN_LANG,
  id : 'lang', 
  store:[['tr','Türkçe'],['ru','Русский'],['en','English']],
  mode: 'local',
  triggerAction: 'all',
  value: 'tr',
  selectOnFocus:true
},

Also, when i click on reset , the combo box should be reset to the first value in case selected any-other value.

Shez Ratnani
  • 312
  • 3
  • 15
RKCY
  • 4,095
  • 14
  • 61
  • 97

1 Answers1

0

Do you mean that you want a combobox and you want a button which reselects the first value from combobox? If that is so. Here is an example. This is how you do it:-

Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Favourite Color',

        id: 'FavouriteColor',
        name: 'FavouriteColor',
        editable: false,
        queryMode: 'local',
        displayField: 'name',
        valueField: 'abbr',
        renderTo: Ext.getBody(),
        store: Ext.create('Ext.data.Store', {
            fields: ['abbr', 'name'],
            data: [{
                "abbr": "blue",
                "name": "Blue"
            }, {
                "abbr": "black",
                "name": "Black"
            }, {
                "abbr": "green",
                "name": "Green"
            }, {
                "abbr": "purple",
                "name": "Purple"
            }, {
                "abbr": "orange",
                "name": "Orange"
            }, {
                "abbr": "red",
                "name": "Red"
            }]
        })

    });

    Ext.create('Ext.Button', {
        renderTo: Ext.getBody(),
        text: 'Reset',
        handler: function () {
            Ext.getCmp('FavouriteColor').setValue('blue');
        }

    });

For future references, please refer to the Sencha ext documentation for the right format to create combobox.

Shez Ratnani
  • 312
  • 3
  • 15