,{
text:'修改',
iconCls:'tool-edit',
handler:function(){
myWindow.setTitle('修改基站');
var record = grid.getSelectionModel().getSelected();
Ext.getCmp('aaa').setValue('1');
if (record) {
Ext.getCmp('jizhanCode').setValue(record.data.vc_Code);
Ext.getCmp('jizhanName').setValue(record.data.vc_Name);
//Ext.getCmp('areaID').setRawValue(record.data.areaID)
Ext.getCmp('jizhanHid').setValue(record.data.i_HID);
Ext.getCmp('jizhantype').setValue(record.data.i_Type);
Ext.getCmp('areaName').setValue(record.data.areaID);
Ext.getCmp('other').setValue(record.data.vc_Memo);
myWindow.show();
}
else
我点击修改时赋值上去的 ,早点增加的时候值还在控件上面
tbar:[{
text:'增加',
iconCls:'tool-add',
handler:function(){
// alert("aaa");
//eval('alert("aaa");');
myWindow.setTitle('增加基站');
myWindow.show();
}这个事增加的代码,我试过form.getForm().reset(); 但是我的那些组件式写在window中的,我不知道如何清空
myWindow = new Ext.Window({
closeAction: 'hide',// 关闭窗口是销毁窗口,为'hide'则隐藏,close销毁
closable: true,//是否可关闭
id:'windowmy',
maximizable : false,//是否可最大化
minimizable : false,//是否可最小化
draggable: true,//拖动
resizable: true, //变大小
constrainHeader:true,//窗口顶部不能超出浏览器边界
modal: true,//为模式窗口,后面的内容都不能操作(屏蔽)
width:583,
border:false,
height:399,
items:[{
xtype:"form",
id:'form1',
layout:"column",
frame:true,
isnew:true,
items:[{
columnWidth:"1",
xtype:"panel",
labelWidth:55,
labelAlign:"left",
layout:"form",
items:[{
xtype:"textfield",
fieldLabel:"基站编号",
name:'jizhanCode',
id:'jizhanCode',
emptyText:'请填写基站编号',
blankText:'请填写基站编号',
anchor:"99%",
allowBlank:false,
msgTarget:'qtip'
}]
},{
columnWidth:"1",
xtype:"panel",
labelWidth:55,
labelAlign:"left",
layout:"form",
items:[{
xtype:"textfield",
fieldLabel:"基站名称",
name:'jizhanName',
id:'jizhanName',
emptyText:'请填写基站名称',
blankText:'请填写基站名称',
allowBlank:false,
msgTarget:'qtip',
anchor:"99%"
},{
xtype:"textfield",
fieldLabel:"基站HID",
name:'jizhanHid',
id:'jizhanHid',
emptyText:'请填写基站HID',
blankText:'请填写基站HID',
allowBlank:false,
msgTarget:'qtip',
anchor:"99%"
},{
fieldLabel:'基站类型',
xtype:'combo',
id:'jizhantype',
//hiddenName:'Qdeptid',
store:new Ext.data.JsonStore({
url:'/KJ222/Jizhan/getType',
fields:['jizhantype'],
autoLoad:true
}),
displayField:'jizhantype',
//valueField:'Qdeptid',
forceSelection:true,
selectOnFocus:true,
editable:false,
anchor:"99%",
triggerAction:'all',
model:'local',
blankText:'请选择基站类型',
allowBlank:false,
msgTarget:'qtip',
emptyText:'请选择基站类型',
//fieldLabel: '区域类型',
name: 'jizhantype'
// value: ''
},{
fieldLabel:'区域名称',
xtype:'combo',
id:'areaName',
hiddenName:'areaID',
store:new Ext.data.JsonStore({
url:'/KJ222/Jizhan/getAllAreaplace',
fields:['areaID','areaName'],
autoLoad:true
}),
displayField:'areaName',
valueField:'areaID',
forceSelection:true,
selectOnFocus:true,
editable:false,
anchor:"99%",
triggerAction:'all',
model:'local',
blankText:'请选择基站类型',
allowBlank:false,
msgTarget:'qtip',
emptyText:'请选择基站类型',
//fieldLabel: '区域类型',
name: 'areaName'
}
]
},{
columnWidth:"1",
xtype:"panel",
labelWidth:55,
labelAlign:"left",
layout:"form",
items:[{
xtype:"htmleditor",
anchor:"99%",
height:200,
name:'other',
id:'other',
fieldLabel:"基站说明"
},{
xtype:"textfield",
fieldLabel:"标签",
name:'aaa',
id:'aaa',
hidden: true,
hideLabel:true,
anchor:"99%"
}]
}]
}],
buttons:[{
text:'确定',
handler:function(){
var record = grid.getSelectionModel().getSelected();
var thisurl;
var isky = Ext.getCmp('aaa').getValue();
if(record){
if(isky==1){
thisurl='/KJ222/Jizhan/UpdateJizhan?updateID='+record.data.iD;
}
else{
thisurl='/KJ222/Jizhan/InsertJizhan';
}
}
else
{
thisurl='/KJ222/Jizhan/InsertJizhan';
}
Ext.getCmp("form1").getForm().submit({
url:thisurl,
waitMsg:'资料提交中,请稍候......',
success:function(){
Ext.MessageBox.alert("提示","添加数据成功");
myWindow.hide();
ds.reload(); //提交成功刷新表格数据
},
failure:function(){
Ext.MessageBox.alert("提示","提交失败:<br><br>(1)可能是你提交的数据有问题<br><br>(2)可能基站编号和基站名称已经存在<br><br>请核实后进行操作");
}
});
}
},{
text:'取消',
handler:function(){
myWindow.hide();}
}]
});
这个事window的代码,我想点击修改的时候赋值,点击增加的时候把原来附上去的值清空掉,就是这样
我在增加里面加了 Ext.getCmp("form1").getForm().reset();
但是很奇怪,我先点增加再点修改,form清空,可是我先点修改在点增加又不行了,这是什么原因啊?