两个Combobox的值都一样,第一一个Combobox选择值后,提交,第二个Combobox默认选中第一个Combobox的值,请教如何搞定?Ext.onReady(function(){
var form =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}],
buttons:[{
text:'提交',
handler:function(){
alert(Ext.getCmp('temp').getValue());
form.getForm().submit({
success:function(form,action){
Ext.Msg.alert('信息',action.result.msg);
},
failure:function(){
Ext.Msg.alert('错误','操作失败');
}
});
}
}]
});
form.render("form");
var form1 =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp1',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}]
});
form1.render("form");
});
var form =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}],
buttons:[{
text:'提交',
handler:function(){
alert(Ext.getCmp('temp').getValue());
form.getForm().submit({
success:function(form,action){
Ext.Msg.alert('信息',action.result.msg);
},
failure:function(){
Ext.Msg.alert('错误','操作失败');
}
});
}
}]
});
form.render("form");
var form1 =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp1',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}]
});
form1.render("form");
});
解决方案 »
- jquery如何遍历获取table中某个td的属性?
- 我用jquery探测网络是否连接代码。提示没有权限
- 请教一个关于JS代码的问题,高手请进
- jquery截取字串并绑定事件的问题
- 如何做到:一个数字串,比如说8位,数字狂变,变的根本看不出来,目是想做一个抽奖程序...
- 怎么用 可视高度判断 提示框显示在可视高度的上半部分显示还是在下半部分显示
- 梅老大的那棵“树”在哪?我找不到了~
- 请问:网页对话框怎样把标题栏去掉?
- showmodledialog加codethat的tree的用法疑难??
- 使用window.open()弹出新窗口,使用IE时只会在新标签页打开。
- js 脚本错误的问题求解啊
- js 字符串替换
combox2.setValue(combox1.getValue())
}以上是思路 具体看ext API
var form =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}],
buttons:[{
text:'提交',
handler:function(){
var v=Ext.getCmp('temp').getValue();
alert(v);
form.getForm().submit({
success:function(form,action){
//修改这里
form1.form.findField("combo").setValue(v);
Ext.Msg.alert('信息',action.result.msg);
},
failure:function(){
Ext.Msg.alert('错误','操作失败');
}
});
}
}]
});
form.render("form");
var form1 =new Ext.form.FormPanel({
labelAlign:'right',
title:'form',
labelWidth:100,
frame:true,
width:300,
items:[{
xtype:"combo",
id:'temp1',
fieldLabel: '设备模板',
name: 'combo',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
['value1', 'SF气体泄漏报警系统'],
['value2', '火灾报警器']
]
}),
displayField: 'text',
valueField: 'value',
mode: 'local',
emptyText:'---请选择---'
}]
});
form1.render("form1");
});