My issue lies in setting the selectfield for England, which I am retrieving from the server. Despite being able to set textfields like this:
Ext.getCmp('email').setValue(email);
Why doesn't this work for selectfields?
I am relatively new to Sencha and now attempting to convert an array.
var testcountry = Ext.create('Test.store.CountryList');
console.log("Length of Country===" + testcountry.getCount());
console.log("Country===" + testcountry);
for (var i = 0; i < testcountry.getCount(); i++){
console.log("Country Value--" + testcountry.getAt(i).data.country);
}
The line console.log("Country Value--" + testcountry.getAt(i).data.country);
prints all countries as undefined in the console.
In the Model:
Ext.define('Test.model.countryList', {
extend: 'Ext.data.Model',
alias: 'widget.countrylist',
config: {
fields: ['text']
}
});
In the Store:
Ext.define('Test.store.countryList', {
extend: 'Ext.data.Store',
config: {
storeId: 'countryList',
model: 'Test.model.countryList',
data: [
{ text: ''},
{ text: 'Japan'},
{ text: 'India'},
{ text: 'Spain'},
{ text: 'Australia'},
{ text: 'Sudan'},
{ text: 'Brazil'},
{ text: 'Mexico'},
{ text: 'England'},
{ text: 'China'},
]
}
});
The Console output is as follows:
Length of Country===9
Country===[object Object]
Country Value--undefined
Country Value--undefined
Country Value--undefined
Country Value--undefined
Country Value--undefined
Country Value--undefined
Country Value--undefined
Country Value--undefined
How can I properly display all countries?