I\'m migrating my application from ExtJs 3 to 4 version. I have several comboboxes at my formPanel, and previously I\'ve used hiddenName and all that stuff to submit valueFi
Specifying the 'value' parameter in the config is a correct way to set the default values for comboboxes.
In your example, just set forceSelection:false, it will work fine.
In case you want to set forceSelection:true, you should make sure the data returned from your store contains an item which has the value equaling to your default value ('all' in this case).Otherwise, it'll be an empty text by default.
To be more clearly, please replace your dirValuesStore definition by this:
var dirValuesStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name'],
data: [
{id: 'all', name: 'All'},
{id: '1', name: 'Name 1'},
{id: '2', name: 'Name 2'},
{id: '3', name: 'Name 3'},
{id: '4', name: 'Name 4'}
]
})
You will see it works!