代码事例1

/**
 * 新增用户
 */
taoexpo.user.userManage.addUserBasic = function(dataStore) {

 /**
  * 编辑用户基本信息
  */
 var editForm = new Ext.FormPanel({
  url : getContextPath()+'/userManagerSave.htm',
  frame : true,
  layout : 'column',
  labelAlign : 'right',
  labelWidth : 80,
  items : [{
     columnWidth : .49,
     layout : 'form',
     items : [
       {
        xtype : 'textfield',
        fieldLabel : '姓名',
        name : 'name',
        id : 'name',
        width : 140,
        value : '',
        readOnly : false,
        allowBlank:false
       },{
        xtype : 'textfield',
        fieldLabel : '手机',
        name : 'mobile',
        id : 'mobile',
        width : 140,
        hidden : false,
        regex : /^1[3|4|5|8][0-9]\d{4,8}$/,
        regexText : '请输入正确的手机号码'
       }

     ]
    },
    {
     columnWidth : .49,
     layout : 'form',
     items : [
       {
        xtype : 'textfield',
        fieldLabel : '密码',
        name : 'password',
        id : 'password',
        width : 140,
        hidden : false,
        allowBlank:false
       }

     ]
    }]
 });
 /***************************************************************************
  * 定义新 window用来显示编辑页面
  **************************************************************************/
 var editWin = new Ext.Window({
  title : '新增用户基本信息',
  width : 550,
  height : 160,
  autoScroll : false,
  bodyStyle : 'padding:5px;',
  buttonAlign : 'center',
  items : editForm,
  buttons : [ {
   text : '保存',
   handler : function() {
    if(editForm.getForm().isValid()){
    editForm.getForm().submit({
      timeout:60000,
         waitMsg:'正在保存,请稍后...',
         failure:function(form,action){        
         Ext.Msg.alert("failure","保存失败!");
         },
         success:function(form,action){        
          if(!action.result.success){          
           Ext.Msg.alert('提示', '用户已存在,插入失败');
          }
                           Ext.Msg.alert('提示', '保存成功');
       editWin.close();
       dataStore.load({
        params : {
         start : 0,
         limit : 10
        }
       });

       
 
         }       
   });
    
    }else {
     Ext.MessageBox.alert('提示', '请输入必输项!');
    } 
  
   }
  }, {
   text : '取消',
   handler : function() {
    editWin.close();
   }
  } ]
 });
 editWin.show();
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值