myMask = new Ext.LoadMask("userRoleGrid", { msg: "正在加载......" });
myMask.show();
var addUserRoleForm = new Ext.FormPanel({
width:300,
height: 180,
labelAlign: "right",
labelWidth: 70,
buttonAlign: "center",
frame: true,
layout: "form",
id: "addform",
items: [{
xtype: "textfield",
fieldLabel: "角色名称",
width: 150,
id: "rolename",
allowBlank: false, //如果是true,则允许,否则不允许,默认是true
blankText: "请输入角色名称!", //如果allowBlank 设置为true,并且那个textField的值为空,则会显示blankText属性的字符串以给出错误提示
emptyText: "请输入角色名称!"
}, {
xtype: "textarea",
fieldLabel: "角色描述",
width: 150,
id: "roleNote"
}]
});
if (dataRow != null) {
Ext.getCmp("rolename").setValue(dataRow.RoleName);
Ext.getCmp("roleNote").setValue(dataRow.RoleNote);
}
newWin = new Ext.Window
(
{
layout: 'fit',
width: 300,
height: 180,
autoScroll: true,
modal: true,
collapsible: true, //允许缩放条
closeAction: 'close',
closable: true,
plain: true,
constrain: true,
shadow: false,
title: '添加角色',
items: addUserRoleForm,
buttons: [{
text: "添加",
id: "btnadd",
iconCls: "savebtn",
handler: function() {
//添加操作
if (addUserRoleForm.form.isValid()) {
if (dataRow != null) {
addUserRoleForm.form.submit({
url: "../ajax/mapHandler.ashx?action=udpateUserRole",
waitMsg: "正在执行修改操作",
params: { roleID: dataRow.RoleID },
success: function(form, action) {
// Ext.Msg.alert(action.result);
if (action) {
Ext.Msg.alert("提示", "恭喜您,角色修改成功!", function() {
newWin.close();
Rolegrid.store.reload(); //重新加载grid
});
}
},
failure: function(form, action) {
if (action) {
Ext.Msg.alert("提示", "角色修改失败!");
}
}
});
} else {
addUserRoleForm.form.submit({
url: "../ajax/mapHandler.ashx?action=addUserRole",
waitMsg: "正在执行添加操作",
//params: { hide: hide },
success: function(form, action) {
// Ext.Msg.alert(action.result);
if (action) {
Ext.Msg.alert("提示", "恭喜您,角色添加成功!", function() {
newWin.close();
Rolegrid.store.reload(); //重新加载grid
});
}
},
failure: function(form, action) {
if (action) {
Ext.Msg.alert("提示", "角色添加失败!");
}
}
});
}
} }
}, {
text: "取消",
id: "closeAddWin",
iconCls: "closebtn",
handler: function() {
newWin.close();
}
}]
}
)
//显示窗体
newWin.show();
if (dataRow != null) {
Ext.getCmp("btnadd").setText("修改");
newWin.setTitle("修改角色信息");
}
myMask.hide();
myMask.show();
var addUserRoleForm = new Ext.FormPanel({
width:300,
height: 180,
labelAlign: "right",
labelWidth: 70,
buttonAlign: "center",
frame: true,
layout: "form",
id: "addform",
items: [{
xtype: "textfield",
fieldLabel: "角色名称",
width: 150,
id: "rolename",
allowBlank: false, //如果是true,则允许,否则不允许,默认是true
blankText: "请输入角色名称!", //如果allowBlank 设置为true,并且那个textField的值为空,则会显示blankText属性的字符串以给出错误提示
emptyText: "请输入角色名称!"
}, {
xtype: "textarea",
fieldLabel: "角色描述",
width: 150,
id: "roleNote"
}]
});
if (dataRow != null) {
Ext.getCmp("rolename").setValue(dataRow.RoleName);
Ext.getCmp("roleNote").setValue(dataRow.RoleNote);
}
newWin = new Ext.Window
(
{
layout: 'fit',
width: 300,
height: 180,
autoScroll: true,
modal: true,
collapsible: true, //允许缩放条
closeAction: 'close',
closable: true,
plain: true,
constrain: true,
shadow: false,
title: '添加角色',
items: addUserRoleForm,
buttons: [{
text: "添加",
id: "btnadd",
iconCls: "savebtn",
handler: function() {
//添加操作
if (addUserRoleForm.form.isValid()) {
if (dataRow != null) {
addUserRoleForm.form.submit({
url: "../ajax/mapHandler.ashx?action=udpateUserRole",
waitMsg: "正在执行修改操作",
params: { roleID: dataRow.RoleID },
success: function(form, action) {
// Ext.Msg.alert(action.result);
if (action) {
Ext.Msg.alert("提示", "恭喜您,角色修改成功!", function() {
newWin.close();
Rolegrid.store.reload(); //重新加载grid
});
}
},
failure: function(form, action) {
if (action) {
Ext.Msg.alert("提示", "角色修改失败!");
}
}
});
} else {
addUserRoleForm.form.submit({
url: "../ajax/mapHandler.ashx?action=addUserRole",
waitMsg: "正在执行添加操作",
//params: { hide: hide },
success: function(form, action) {
// Ext.Msg.alert(action.result);
if (action) {
Ext.Msg.alert("提示", "恭喜您,角色添加成功!", function() {
newWin.close();
Rolegrid.store.reload(); //重新加载grid
});
}
},
failure: function(form, action) {
if (action) {
Ext.Msg.alert("提示", "角色添加失败!");
}
}
});
}
} }
}, {
text: "取消",
id: "closeAddWin",
iconCls: "closebtn",
handler: function() {
newWin.close();
}
}]
}
)
//显示窗体
newWin.show();
if (dataRow != null) {
Ext.getCmp("btnadd").setText("修改");
newWin.setTitle("修改角色信息");
}
myMask.hide();
解决方案 »
- 在javascript中,如何往TD中写入javascript代码?
- 用js做一个web版的连线题,求大神降临
- EXTJS grid 排序 我给显示的字段设置了 SORTABLE=TRUE 为什么有的字段可以排序有的字段不可以排序呢
- 如何实现按键盘特定键让网页转到特定页面的功能
- JSP中表单提交的javascript的问题
- google.maps.Geocoder反向地址解析怎么得到英文地址?
- 窗口问题,知道的请进来!
- 希望大家帮帮我,JSP加载一张图片,在图片的前面显示数据库里面数据,怎么弄呢?
- 构造函数的原型对象被改变后,用此构造函数创建的对象的constructor属性不在指向最初的构造函数?
- 求助,vue动态绑定src,内容渲染上去了但是没有效果
- 火狐,我恨死你了!这到底什么问题
- dom如何控制z-index属性?
按顺序执行
先执行 myMask = new Ext.LoadMask(...........
再执行 var addUserRoleForm = new Ext.FormPanel(..........
道理上没有错,
你是如何判断 LoadMask不是在formPanel之前加载的 这里我没有找到你的判断依据。请你告诉我们。
另外中间一个 myMask.show(); 是调用的什么方法。有时先把程序最小化,其错误你也会自然而然的就发现了。
var myMask = new Ext.LoadMask("userRoleGrid", { msg: "正在加载......" });
myMask.show(); //show是extjs封装的函数,可以直接调用的
中间是一个window就是比较长的那段代码
myMask.hide();//隐藏LoadMask
url : this.metadata.loadUrl,
params : {
queryID : selectedId,
nodetype: 'P'
},
scope : this,
waitMsg : '正在加载...', //其实,有这个就可以了...
success : function(form, action) {
myMask.show();