var cityStore = Ext.create(“Ext.data.Store”,{
fields : [“name”],
autoLoad : false,
proxy : {
type : “ajax”,
url : “citiesServlet”,
reader : { type : “json”}
}
}});
The cityStore is populated by sending a request to a ‘citiesServlet’. The city combo box can be mapped to the cityStore. The country and city combo boxes are declared as shown below.
{
xtype : “combo”,
displayField : “name”,
fieldLabel : “Country”,
store : {
fields : [“name”],
data : [
{name:”India”},{name:”UK”},{name:”USA”}
]
},
listeners : {
change : function(source,newValue,oldValue){
cityStore.proxy.extraParams = {“country” : newValue};
cityStore.load();
},
}
},
{
xtype : “combo”,
store : cityStore,
displayField : “name”,
fieldLabel : “City”
}