combox二级联动相关

项目中用到EXT作一个二级联动,由于刚接触EXT,故不太熟悉,对于combox store动态传参有些问题没想通。下面先把正确的代码贴出,请批评指正:

 

第一个combox:

 

{

id : 'OfficeID',

xtype:'combo',

triggerAction: 'all',

labelSeparator:' ',

fieldLabel: '局向<font color=red>*</font>: ',

anchor:'90%',

store:new Ext.data.Store

({

autoLoad:true,

proxy:new Ext.data.HttpProxy

({

url: "<%=request.getContextPath() %>/inck/query/inckAdslDevNeAction.do?method=userOfficeRightList"

}),

reader: new Ext.data.JsonReader

(

{root: "datas"},

[

{name:"OFFICE_ID",type:'string'},

{name:"OFFICE_NAME",type:'string'}

]

),

listeners: 

{

load: function(store)

if(store.getTotalCount()==1)

{

Ext.getCmp("OfficeID").setValue(store.getAt(0).get('OFFICE_ID')); 

alert(Ext.getCmp("OfficeID").getValue());

}

}

}),

valueField : "OFFICE_ID",

typeAhead : true,

displayField : "OFFICE_NAME",

emptyText : '请选择局向',

mode : 'local',

editable:false,

lazyInit:false,

forceSelection:true,

listeners:

{

"select": function(combo)

{

officeSelect=Ext.getCmp("OfficeID").getValue();

alert(officeSelect);

Ext.getCmp('dslamip').clearValue(); 

// Ext.getCmp('dslamip').store.reload(); 

Ext.getCmp('dslamip').store.load({params:{OFFICE_ID:officeSelect}});//这里给第二个combox赋值成功

//document.getElementById('officeName').value = "";

// document.getElementById('officeIdTreeCode').value = "";

}

 

}

}

 

 

 

 

第二个combox:

 

  {

id : 'dslamip',

xtype:'combo',

triggerAction: 'all',

labelSeparator:' ',

fieldLabel: 'DSLAMIP <font color=red>*</font>: ',

anchor:'90%',

store:new Ext.data.Store

({

//autoLoad:true,

proxy:new Ext.data.HttpProxy

({

url: "<%=request.getContextPath() %>/inck/query/inckAdslDevNeAction.do?method=userOfficeDSLAMIPList"// url: "<%=request.getContextPath() %>/inck/query/inckAdslDevNeAction.do?method=userOfficeDSLAMIPList&OfficeID='100307'"这里静态赋值成功,但用变量代替就不行,也不知道为什么啊

}),

reader: new Ext.data.JsonReader

(

{root: "dslamip_datas"},

[

{name:"dslamip",type:'string'}

]

),

// baseParams: { OFFICE_ID:officeSelect} ,//这里动态赋参数不成功,不知道为什么?

listeners: 

{

load: function(store)

if(store.getTotalCount()==1)

{

//Ext.getCmp("OfficeID").setValue(store.getAt(0).get('OfficeID')); 

//document.getElementById('officeName').value = "";

//document.getElementById('officeIdTreeCode').value = "";

}

}

}),

valueField : "dslamip",

typeAhead : true,

displayField : "dslamip",

emptyText : '请选择DSLAM IP',

mode : 'local',

editable:false,

lazyInit:false,

forceSelection:true

}

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值