ExtJs 添加布局

insert = function(ds) {
 
 Ext.QuickTips.init();// 用来提示信息
 Ext.form.Field.prototype.msgTarget = 'side';// 统一指定错误提示方式
 var userTxt = new Ext.form.TextField({
    fieldLabel : '用户名称',
    name : 'admin.username',
    anchor : '98%'
   })
 var pwdTxt = new Ext.form.TextField({
    fieldLabel : '用户密码',
    name : 'admin.password',
    anchor : '98%'
   })

 var myForm = new Ext.form.FormPanel({
    labelAlign : 'right',
    labelWidth : 60,
    frame : true,
    items : [{
       xtype : 'fieldset',
       title : '增加用户',
       autoHeight : true,
       items : [{// 第1行
        layout : 'column',
        items : [{
           columnWidth : 1,
           layout : 'form',
           items : userTxt
          }]
       }, { // 第2行
          layout : 'column',
          items : [{
             columnWidth : 1,
             layout : 'form',
             items : pwdTxt
            }]
         }]
      }],
    buttons : [{
     text : '提交',
     handler : function() {
      if (myForm.getForm().isValid()) {
       Ext.MessageBox.show({
          msg : '正在提交,请稍等...',
          progressText : 'Saving...',
          width : 300,
          wait : true,
          waitConfig : {
           interval : 200
          },
          icon : 'download',
          animEl : 'saving'
         });
       myForm.form.submit({
          url : "saveAdmin.action",
          method : "POST",
          success : function(form, action) {
//           var flag = action.result.success;
//           if (flag == "true") {
            Ext.MessageBox.alert("恭喜","提交成功!");
            insert_Win.close();
            ds.reload();
//           }
          },
          failure : function(form, action) {
           Ext.MessageBox.alert("提示!", "提交失败!");
          }
         });
      }
     }
    }, {
     text : '重置',
     handler : function(){
      myForm.form.reset();
     }
    }]
   });

 var insert_Win = new Ext.Window({
    plain : true,
    layout : 'form',
    resizable : true, // 改变大小
    draggable : true, // 不允许拖动
    closeAction : 'close',// 可被关闭 close or hide
    modal : true, // 模态窗口
    width : 200,
    autoHeight : true,
    title : '增加记录',
    items : [myForm],// 嵌入数据
    buttonAlign : 'center',
    loadMask : true
   });
 insert_Win.show();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值