数据加载的时候,城市的下拉菜单能出来,选择了城市之后想要选择地区,地区的placestore就一直是空的。
困扰了好久,求解决。
[code="java"] var citystore=new Ext.data.Store({
proxy:new Ext.data.HttpProxy({
url:'city_query.action'
}),
reader:new Ext.data.JsonReader({
totalProperty:'total',
root:'cityList'
},[
{name:'id'},
{name:'name'}
])
});
var placestore=new Ext.data.Store({
proxy:new Ext.data.HttpProxy({
url:'place_query.action'
}),
reader:new Ext.data.JsonReader({
totalProperty:'total',
root:'placeList'
},[
{name:'id',type:String},
{name:'name',type:String},
{name:'cityid',type:String}
])
});
var comboCity=new Ext.form.ComboBox({
//applyTo:'comboCity',
fieldLabel:'城市',
emptyText:'请选择',
autowidth:true,
selectOnFocus:true,
forceSelection: true,
mode:'local',
triggerAction:'all',
//triggerAction:'query',
name:'place.cityid',
store:citystore,
valueField:'id',
displayField:'name',
hiddenName:'id'
});
var comboPlace=new Ext.form.ComboBox({
//applyTo:'comboPlace',
fieldLabel:'地区',
emptyText:'请选择',
autowidth:true,
selectOnFocus:true,
forceSelection: true,
mode:'local',
triggerAction:'all',
//triggerAction:'query',
//valueField:'id',
displayField:'name',
hiddenName:'name',
name:'place.name',
store:placestore
});
citystore.load();
comboCity.on('select',function(comboBox){
var value=comboBox.getValue();
placestore.load({params:{id:value}});
alert(value);
});
var theForm=new Ext.FormPanel({
labelSeparator :":",
layout:'form',
frame :true,//渲染面板为自定义的圆角边框
border :false,//不显示面板体边框
autoHeight: true,
items:[{
xtype:'textfield',
fieldLabel:'地区编号',
name:'place.id',
displayField:'id',
maxLength:6,
autowidth:true,
allowBlank:false
},
comboCity,comboPlace
]
});[/code]
可能 新增的时候 没向后台传cityid值
comboCity 这个是 城市的下拉框吧 向后台传得属性名是hiddenName:"cityid"
我是经常用火狐 看向后台传得参数 或者后台向页面发得参数 这也非常容易是页面问题还是后台的问题
用火狐看看 placestore.load({params:{id:value}});
这个执行完后 加载成功数据没?
[quote]数据没有加载到placestore里面去,一直是空的[/quote]
数据都没有 后台的原因吧 看看后台有没有向页面发数据了
什么id?