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





}
}