EXT 二级联动 第二级显示不出来值.

问题如下:二级下拉框没有值显示...后台能取到值,但查了老久不知道为什么就是显示不出来.代码如下:

[code="java"]function start(){
/**
* 查询所有大类
*/
var areaProxy = new Ext.data.HttpProxy({
url : "/iuseprice/priceType/findArea.action"
})
var areaList = new Ext.data.Record.create([{
name : "area",
mapping : "area"
}])
var areaReader = new Ext.data.JsonReader({},areaList);
var areaStore = new Ext.data.Store({
proxy : areaProxy,
reader : areaReader
});

var townshipStore = getTownship('');

var hidden = new Ext.form.Hidden({
    id:"_areaId",
    name:"area.areaId",
    width:0
})

/**

  • 初始Form / var loggingForm = new Ext.FormPanel({ frame : false, layout : "form", url : "", renderTo : "_addPriceType", heigth : "100%", width : "100%", border : false, items : [{//煤炭类型设置 xtype : 'fieldset', title : '煤炭类型设置', layout : 'column', width : "70%", items : [{//第一行 xtype : 'fieldset', title : '煤矿设置', layout : 'column', height : '100%', width : "100%", columnWidth : 1, labelWidth : 60, items : [{ layout : "form", border : false, columnWidth : .2, items : [ areaComboBox = new Ext.form.ComboBox({ store:areaStore, fieldLabel : "区域名称", displayField : "area", valueField : "area", id:"areaCode", hiddenName:"area.area", width : 120, triggerAction : "all", mode : "remote", value : "--请选择--", forceSelection : true, selectOnFocus : true, typeAhead : true, hiddenName : "areaName", listeners : { 'select' : function(areaComboBox){ townshipComboBox.enable(); townshipComboBox.clearValue() ; var id = Ext.getCmp("areaCode").getValue(); alert(id) townshipStore.reload({params:{areaName:id}}); } } }) ] },{ layout : "form", border : false, columnWidth : .2, items : [ townshipComboBox = new Ext.form.ComboBox({ store:townshipStore, fieldLabel : "乡镇名称", displayField : "township", valueField : "areaId", id:"_township", hiddenName :"area.township", width : 120, triggerAction : "all", mode : "remote", value : "--请选择--", forceSelection : true, selectOnFocus : true, typeAhead : true, disabled : true }) ] },{ layout : "form", border : false, columnWidth : .2, items : [{ xtype : "textfield", width : 120, fieldLabel : "煤矿名称" }] },{ layout : "form", border : false, columnWidth : .05, items : [{ xtype : "button", text : '设置' }] }] }] }] }); } /*
  • 通过区域名称查询乡镇 */

function getTownship(areaName2){
var townshipProxy = new Ext.data.HttpProxy({
url : "/iuseprice/area/findTownshipByAreaName.action"
});
var townshipList = new Ext.data.Record.create([{
name : "areaId",
type : "int",
mapping : "areaId"
},{
name : "township",
type : "string",
mapping : "township"
}]);
var townshipReader = new Ext.data.JsonReader(townshipList);
var townshipStore1 = new Ext.data.Store({
proxy : townshipProxy,
reader : townshipReader
});
// townshipStore1.load({
// params : {areaName:areaName2}
// });
return townshipStore1;
}[/code]

1个回答

var townshipReader = new Ext.data.JsonReader(townshipList);

换成
[code="java"]var townshipReader = new Ext.data.JsonReader({},townshipList); [/code]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!