?? editguestinfo.js
字號:
?// JScript 文件
EditGuestInfo=function(row)
{
var EditGuestInfofp=new Ext.form.FormPanel({
width:380,
height:210,
plain:true,
layout:"form",
defaultType:"textfield",
labelWidth:75,
baseCls:"x-plain",
//錨點(diǎn)布局-
defaults:{anchor:"95%",msgTarget:"side"},
buttonAlign:"center",
bodyStyle:"padding:0 0 0 0",
items:[
{
name:"guestid",
fieldLabel:"<font color=red>客人ID</font>",
readOnly:true
},{
name:"guestname",
fieldLabel:"<font color=red>客人姓名</font>",
allowBlank:false,
blankText:"客人姓名不允許為空",
regex:/^[\s\S]{1,10}$/,
regexText:"客人姓名請不要超過10個字符"
},{
name:"guestcardid",
fieldLabel:"身份證號",
allowBlank:false,
blankText:"身份證號不允許為空",
regex:/^[0-9.]{15,18}$/,
regexText:"身份證號為15-18位數(shù)字組成"
},{
name:"guestsexs",
xtype:"combo",
fieldLabel:"客人性別",
//傳入后臺真實值value field /value
hiddenName:"guestsex",
readOnly:true,
mode:"local",
displayField:"show",
valueField:"value",
triggerAction:"all",
value:"0",
store:new Ext.data.SimpleStore({
fields:["show","value"],
data:[["男","0"],["女","1"]]
})
},{
name:"guestmobile",
fieldLabel:"電話號碼",
allowBlank:false,
blankText:"電話號碼不允許為空",
regex:/^[0-9.]{8,13}$/,
regexText:"電話號碼為8-13位數(shù)字組成"
},{
name:"guestaddress",
xtype:"textfield",
fieldLabel:"客人地址",
allowBlank:false,
blankText:"客人地址不允許為空",
regex:/^[\s\S]{1,50}$/,
regexText:"客人地址請不要超過50個字符"
}]});
var EditGuestInfoWin=new Ext.Window({
title:"添加客人信息",
width:425,
height:235,
plain:true,
iconCls:"addicon",
//不可以隨意改變大小
resizable:false,
//是否可以拖動
//draggable:false,
defaultType:"textfield",
labelWidth:100,
collapsible:true, //允許縮放條
closeAction : 'hide',
closable:true,
plain : true,
//彈出模態(tài)窗體
modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:10px 0 0 15px",
items:[EditGuestInfofp],
listeners:{
"show":function()
{
//當(dāng)window show事件發(fā)生時清空一下表單
EditGuestInfofp.getForm().loadRecord(row);
}
},
buttons:[{
text:"保存信息",
minWidth:70,
handler:function()
{
if(EditGuestInfofp.getForm().isValid())
{
//彈出效果
Ext.MessageBox.show
(
{
msg: '正在保存,請稍等...',
progressText: 'Saving...',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'download',
animEl: 'saving'
}
);
setTimeout(function(){Ext.MessageBox.hide();
}, 1000);
EditGuestInfofp.form.submit({
url:"URL/GuestInfo/EditGuestInfo.aspx",
method:"POST",
success:function(form,action)
{
//成功后
var flag=action.result.success;
if(flag=="true")
{
EditGuestInfoWin.hide();
GuestInfoStore.reload();
}
},
failure:function(form,action)
{
Ext.MessageBox.alert("提示!","保存客人信息失敗!");
}
});
}
}
},{
text:"重置",
minWidth:70,
qtip:"重置數(shù)據(jù)",
handler:function()
{
EditGuestInfofp.getForm().loadRecord(row);
}
},{
text:"取 消",
minWidth:70,
handler:function()
{
EditGuestInfoWin.hide();
}
}]
});
EditGuestInfoWin.show();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -