• ext_初用


    <script type="text/javascript">
      
      function formplan(){ 
          //定义文本输入框
          var asname = new Ext.form.TextField({name:"assignment.assname",
            fieldLabel:"任务名称", //
            200,
            allowBlank:false,    //验证是否为空
            blankText:'不能为空'});
          var utilname = new Ext.form.TextField({
              name:"assignment.unitname",fieldLabel:'乘文单位',200,allowBlank:false,blankText:'不能为空'
          })
    //时间控件
    var startdate = new Ext.form.DateField({fieldLabel : '开始日期', xtype:"datefield",  //类型 name : 'assignment.starttime',   //与struts实体属性对应 format:"Y-m-d",    //样式 editable:false}); var stopdate = new Ext.form.DateField({fieldLabel:'结束日期',xtype:'datefield', name:'assignment.stoptime',format:'Y-m-d',editable:false}); //表单 var form= new Ext.form.FormPanel({ title:'form',400,
                 //把控件添加到表单里去
                items:[asname,utilname,startdate,stopdate],buttons:[ { //定义buttons按钮 id:
    'btnOk', text:'确 定', handler:function() { Ext.MessageBox.show ( { msg: '正在保存,请稍等...', progressText: 'Saving...', 300, wait:true, waitConfig: {interval:200}, icon:'download', animEl: 'saving' } );
                  // 数据提交,与ajax差不多 form.form.submit ( { url:
    'ajax/ass_save.action', method:'post',
                    //action中必须返回一个success=true;否则一直是false 一直调用failure success:
    function(form, action) { Ext.Msg.alert("成功", action.result.assignment.assname); win.destroy(); newpanel(action.result); }, failure: function(form, action) { Ext.Msg.alert("错误","添加数据失败!"); } }); } },{ text:'关 闭', handler:function() { win.destroy(); } } ] }); //定义窗体,并把表单加载到其中 var win = new Ext.Window({ minWidth:740,frame:true, draggable:false,    //(是否可以拖动,默认可以) collapsible:false,    //closable:false,(是否显示关闭,默认有关闭) closeAction : 'hide', //枚举值为:close(默认值),当点击关闭后,关闭window窗口 hide,关闭后,只是hidden窗口 autoScroll:true,   //设为true则内容溢出的时候产生滚动条,默认为false plain : false,    //true则主体背景透明,false则主体有小差别的背景色,默认为false modal: 'true',    //true为模式窗口,后面的内容都不能操作,默认为false title : '信息 添加' ,items:form}); win.show(); } Ext.onReady(function(){ formplan();//加载window窗体 }); function newpanel(action){ var txt1 = new Ext.form.Field({fieldLabel:'任务名称',value:action.assignment.assname,disabled:true}); var txt2 = new Ext.form.Field({fieldLabel:'乘文单位',value:action.assignment.unitname,disabled:true}); var txt3 = new Ext.form.Field({fieldLabel:'开始时间',value:action.assignment.starttime,disabled:true}); var txt4 = new Ext.form.Field({fieldLabel:'结束时间',value:action.assignment.stoptime,disabled:true}); var txt5 = new Ext.form.TextField({emptyText:action.assignment.assid,name:'fruit.assid',disabled:true}); var txt6 = new Ext.form.TextField({fieldLabel:'结果',name:'fruit.addfruit',200,allowBlank:false, blankText:'不能为空'}); var loding = new Ext.form.FormPanel({title:'newForm',400,items:[txt1,txt2,txt3,txt4]}); var result = new Ext.form.FormPanel({title:'添加结果',400,items:[txt6],buttons:[{ id:'btnOk', text:'添加', handler:function() { Ext.MessageBox.show ( { msg: '正在保存,请稍等...', progressText: 'Saving...', 300, wait:true, waitConfig: {interval:200}, icon:'download', animEl: 'saving' } ); result.form.submit ( { url:'ajax/fruit.action?fruit.assid='+action.assignment.assid, method:'post', success: function(form, action) { newWin.destroy(); delet(action.result); }, failure: function(form, action) { Ext.Msg.alert("错误","添加数据失败!"); }});}}, { text:'关 闭', handler:function(){ win.destroy();} } ]}); var newWin = new Ext.Window({minWidth:740,frame:true, draggable:false, collapsible:false, closeAction : 'hide', autoScroll:true, plain : false, modal: 'true', title : '信息 补充' ,items:[loding,result]}); newWin.show(); } function delet(action){ var txt1 = new Ext.form.Field({fieldLabel:'任务名称',value:action.fruit.assignment.assname,disabled:true}); var txt2 = new Ext.form.Field({fieldLabel:'乘文单位',value:action.fruit.assignment.unitname,disabled:true}); var txt3 = new Ext.form.Field({fieldLabel:'开始时间',value:action.fruit.assignment.starttime,disabled:true}); var txt4 = new Ext.form.Field({fieldLabel:'结束时间',value:action.fruit.assignment.stoptime,disabled:true}); var txt6 = new Ext.form.Field({fieldLabel:'结果',value:action.fruit.addfruit,disabled:true}); var result = new Ext.form.FormPanel({title:'删除',400,items:[txt1,txt2,txt3,txt4,txt6],buttons:[{ id:'btnOk', text:'删除', handler:function() { Ext.MessageBox.show ( { msg: '正在操作,请稍等...', progressText: 'Saving...', 300, wait:true, waitConfig: {interval:200}, icon:'download', animEl: 'saving' } ); result.form.submit ( { url:'ajax/ass_delete.action?id='+action.fruit.assid, method:'post', success: function(form, action) { Ext.Msg.alert("操作成功", action.result.info); dleWin.destroy(); }, failure: function(form, action) { Ext.Msg.alert("错误","操作失败!"); }});}}, { text:'关 闭', handler:function(){ win.destroy();} } ]}); var dleWin = new Ext.Window({minWidth:740,frame:true, draggable:false, collapsible:false, closeAction : 'hide', autoScroll:true, plain : false, modal: 'true', title : '查询信息' ,items:[result]}); dleWin.show(); } </script>
  • 相关阅读:
    sqlhelper类
    嵌入式的n个方向
    study vim + cscope
    mail lists
    关于我的学习
    yahoo enter linux mobile competition
    找工作啦 啦啦啦啦啦
    minicom display unsolicited codes
    并购的年代
    配置rt73无线网卡至suse10.3
  • 原文地址:https://www.cnblogs.com/b422/p/ext_first.html
Copyright © 2020-2023  润新知