I wanted to Pass both id and value of combo selected both to controller from ExtJS. In my case, id is country code and value is country name. Here for Combo I am not using var. For ex:
{
xtype: 'combo',
id: 'ADDRESS_COUNTRY_NAME',
name: 'ADDRESS_COUNTRY_NAME',
fieldLabel: 'Country',
width: 300,
displayField: 'name',
store: addrcountriesStore,
queryMode: 'local',
listConfig: {
getInnerTpl: function() {
return '<div data-qtip="{name}">{name}</div>';
}
}}
var addrcountriesStore = Ext.create('Ext.data.Store', {
model: 'AddrCountry',
data: addrcountries
});
var addrcountries = [
{"id":"US","name":"United States"},
{"id":"UK","name":"United Kingdom"},
{"id":"AU","name":"Australia"}
];
Ext.define('AddrCountry', {
extend: 'Ext.data.Model',
fiel开发者_JAVA百科ds: [
{type: 'string', name: 'id'},
{type: 'string', name: 'name'}
]
});
By default country name is going during form post. I need to send corresponding country code as well. Could anybody please help?
Kiran is on the right track. once you get the two variables you need to set a hidden field with one of them (countryID). However it seems wrong to store both on the server - just saying.
精彩评论