日期:2014-05-16  浏览次数:20348 次

extjs 实现保存信息到后台

onSave:function(){
??? ??? ??? ??????
??? ??? ??? ????????? var userName = Ext.getCmp('Fd_userName').getValue();
??? ??? ??? ?????????? var userRealName = Ext.getCmp('Fd_userRealName').getValue();
??? ??? ??? ?????????? var userIDCard = Ext.getCmp('Fd_userIDCard').getValue();
??? ??? ??? ?????????? var userRole = Ext.getCmp('Fd_userRole').getValue();
??? ??? ??? ?????????? var userDep = Ext.getCmp('Fd_userDep').getValue();
??? ??? ??? ?????????? var userGroup = Ext.getCmp('Fd_userGroup').getValue();
??? ??? ??? ?????????? var userMajor = Ext.getCmp('Fd_userMajor').getValue();
??? ??? ??? ?????????? var userWork = Ext.getCmp('Fd_userWork').getValue();
??? ??? ??? ?????????? var registerTime = Ext.getCmp('Fd_registerTime').getValue();
??? ??? ??? ?????????? var lock = Ext.getCmp('Fd_lock').getValue();
??? ??? ??? ?????????? var remark = Ext.getCmp('Fd_remark').getValue();
??? ??? ??? ?????????? console.log(userDep);
??? ??? ??? ?????????
??? ??? ??? ??? ??? ?? if(this.userForm.getForm().isValid()){
??? ??? ??? ??? ??? ??????? var loadMarsk = new Ext.LoadMask(document.body,{
??? ??? ??? ??? ??? ??? ??? ???? msg : '正在提交数据,请稍候...',
??? ??? ??? ??? ??? ??? ??? ???? removeMask : true// 完成后移除
??? ??? ??? ??? ??? ??? ??? });
??? ??? ??? ??? ??? ??? ??? loadMarsk.show(); //显示
??? ??? ??? ??? ??? ??????? Ext.Ajax.request({
??? ??? ??? ??? ??? ??? ??? ??? url : '<%=basePath%>UserServlet.do?method=userUpdate&id=${user.pk_id}',
??? ??? ??? ??? ??? ??? ??? ??? method:'GET',
??? ??? ??? ??? ??? ??? ??? ??? callback : function(options,success,response){
??? ??? ??? ??? ??? ??? ??? ??? ??? var result = Ext.util.JSON.decode(response.responseText);
??? ??? ??? ??? ??? ??? ??? ??? ??? if(result.success){
??? ??? ??? ??? ??? ??? ??? ??? ??? ??? loadMarsk.hide();
??? ??? ??? ??? ??? ??? ??? ??? ??? ??? Ext.Msg.alert("提示","成功保存数据!");
??? ??? ??? ??? ??? ??? ??? ??? ??? ?? //? this.onClose();
??? ??? ??? ??? ??? ??? ??? ??? ??? }else{
??? ??? ??? ??? ??? ??? ??? ??? ??? ??? loadMarsk.hide();
??? ??? ??? ??? ??? ??? ??? ??? ??? ??? Ext.Msg.alert("错误","保存数据失败!");
??? ??? ??? ??? ??? ??? ??? ??? ??? }
??? ??? ??? ??? ??? ??? ??? ??? },
??? ??? ??? ??? ??? ??? ??? ??? params : {
??? ??? ??? ??? ??? ??? ??? ??? ? userName?????? : encodeURIComponent(userName),
??? ??? ??? ??? ??? ??? ??? ??? ??? userRealName : encodeURIComponent(userRealName),
??? ??? ??? ??? ??? ??? ??? ??? ??? userIDCard?? : encodeURIComponent(userIDCard),
??? ??? ??? ??? ??? ??? ??? ??????? userRole???? : encodeURIComponent(userRole),
??? ??? ??? ??? ??? ??? ??? ??????? userDep????? : encodeURIComponent(userDep),
??? ??? ??? ??? ??? ??? ??? ??????? userGroup??? : encodeURIComponent(userGroup),
??? ??? ??? ??? ??? ??? ??? ??????? userMajor??? : encodeURIComponent(userMajor),
??? ??? ??? ??? ??? ??? ??? ??????? userWork???? : encodeURIComponent(userWork),
??? ??? ??? ??? ??? ??? ??? ??????? registerTime : registerTime,
??? ??? ??? ??? ??? ??? ??? ??????? lock???????? : lock,
??? ??? ??? ??? ??? ??? ??? ??????? remark?????? : encodeURIComponent(remark)
??? ??? ??? ??? ??? ??? ??? ??? },
??? ??? ??? ??? ??? ??? ??? ??? scope : this
??? ??? ??? ??? ??? ??? ??? });
??? ??? ??? ???? }
??? ??? ??? ???? },