温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(ExtJs)源码
当前文件:
MyHotelManager/HotelUI/Js/DelRoomType.js,打开代码结构图
MyHotelManager/HotelUI/Js/DelRoomType.js,打开代码结构图1//删除房间类型 2
function DelRoomType() 3
{ 4
//获得房间类型 5
var strType=new Ext.data.Store 6
( 7
{ 8
proxy: new Ext.data.HttpProxy 9
( 10
{ 11
url:'/HotelUI/Json/GetRoomType.aspx' 12
} 13
), 14
//读取Json 15
reader: new Ext.data.JsonReader 16
( 17
{root:'data'}, 18
[ 19
{name:'TypeId',type:'string'}, 20
{name:'TypeName',type:'string'} 21
] 22
) 23
} 24
); 25
strType.load(); 26
27
Ext.QuickTips.init(); 28
Ext.form.Field.prototype.msgTarget = 'side'; 29
var delRoomType = new Ext.FormPanel 30
( 31
{ 32
labelWidth : 75, 33
frame : true, 34
title : '请仔细填写表单', 35
width : 300, 36
waitMsgTarget : true, 37
items: 38
[ 39
new Ext.form.ComboBox 40
( 41
{ 42
fieldLabel: ' 请选择类型', 43
labelStyle: 'width:100px', 44
width:150, 45
editable: false, //不允许输入 46
name: 'TypeName', 47
store:strType, 48
emptyText:'--请选择--', 49
allowBlank:false, //不允许为空 50
blankText:'请选择类型', //错误提示信息 51
displayField:'TypeName', 52
valueField: 'TypeId', 53
hiddenName:'TypeId', 54
mode: 'client', 55
triggerAction: 'all', 56
selectOnFocus:true 57
} 58
) 59
], 60
buttons: 61
[ 62
{ 63
id:'btnOk', 64
text:'确 定', 65
handler:function() 66
{ 67
//如果验证合法 68
if (delRoomType.form.isValid()) 69
{ 70
//弹出效果 71
Ext.MessageBox.show 72
( 73
{ 74
msg: '正在删除,请稍等...', 75
progressText: 'Saving...', 76
width:300, 77
wait:true, 78
waitConfig: {interval:200}, 79
icon:'download', 80
animEl: 'saving' 81
} 82
); 83
setTimeout(function(){}, 10000); 84
//提交到服务器 85
delRoomType.form.submit 86
( 87
{ 88
url:'/HotelUI/Form/DelRoomType.aspx', //提交的页面路径 89
method:'post',//提交方式为post 90
//提交成功的回调函数 91
success:function(form,action) 92
{ 93
var flage = action.result.success; 94
//如果服务器端传过来的数据为true则表示登录成功 95
if (flage == true) 96
{ 97
Ext.MessageBox.alert('恭喜','删除房间类型成功!'); 98
storeToday.reload(); 99
newWin.hide(); 100
} 101
}, 102
//提交失败的回调函数 103
failure:function() 104
{ 105
Ext.Msg.alert('错误','服务器出现错误请稍后再试!'); 106
} 107
} 108
); 109
} 110
} 111
}, 112
{ 113
text:'取 消', 114
handler:function() 115
{ 116
newWin.hide(); 117
} 118
} 119
] 120
} 121
); 122
//定义窗体 123
newWin = new Ext.Window 124
( 125
{ 126
layout : 'fit', 127
width : 320, 128
height : 150, 129
collapsible:true, //允许缩放条 130
closeAction : 'hide', 131
closable:true, 132
plain : true, 133
modal: 'true', 134
title : '删除房间类型', 135
items : delRoomType 136
} 137
); 138
newWin.show(); 139
} 140
141
142
143





}
}