EXT框架

来源:互联网 发布:mac 自带软件能删除吗 编辑:程序博客网 时间:2024/05/22 12:27

         var win = new Ext.Window({             title: '',             closable:false,             //width:985,             //height:650,             resizable:true,             AutoScroll:true,             //constrain:true,             plain:true,             layout: 'border',             monitorResize:true,             items: [query, gdProjects],                 listeners: {                    maximize:function(w){                                  var windowWidth = window.screen.availWidth;                      w.setWidth(windowWidth-220);                        var windowHeight = window.screen.availHeight;                      w.setHeight(windowHeight-220);                   }              }         });         win.show(this);         win.maximize();
gdProjects = new Ext.grid.GridPanel({                            frame:true,                            animCollapse: false,                            region: 'center',                            width :700,                            height:300,                            iconCls: 'icon-grid',                            store: ds,                            cm: cm,                            sm: sm,                            trackMouseOver:true,                            loadMask: {msg:'正在加载数据,请稍侯……'},                            viewConfig: {                                forceFit:true,                                enableRowBody:true,                                getRowClass : function(record, rowIndex, p, ds){                                                   return 'x-grid3-row-collapsed';                                              }                             },                            view: new Ext.grid.GroupingView({                                forceFit:true,                                groupTextTpl: '{text} ({[values.rs.length]}条记录)'                            }),                            bbar: new Ext.PagingToolbar({                                pageSize: 100,                                store: ds,                                displayInfo: true,                                displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',                                emptyMsg: "无显示数据"                           }),                          tbar:[{                               id:'btnAdd',                               text:'新增',                               tooltip:'新增',                               iconCls:'add',                               handler: function(){                               },{                               text:'删除',                               tooltip:'删除',                               iconCls:'删除',                               handler:rsync_info_del                               }]});simple = new Ext.form.FormPanel({});var Tree = Ext.tree;var tree = new Tree.TreePanel({    loader: new Tree.TreeLoader({dataUrl:'{%url svrtree %}'}),});

    var query = new Ext.FormPanel({        region: 'north',        frame:true,             //width :965,               height:300,        title:'查询存储服务器',        bodyStyle:'padding:2px 2px 0',        labelWidth : 40,        collapsible: true,    autoHeight:true,        items :[{        layout:'column',        items:[/*idc_name,{                columnWidth:.2,                layout: 'form',                items: [{                    xtype:'textfield',                    fieldLabel: 'area',                    name: 'area',                    anchor:'95%'                       }]                },{                columnWidth:.2,                layout: 'form',                items: [{                    xtype:'textfield',                    fieldLabel: 'IDC',                    name: 'idc',                    anchor:'95%'                        }]                },  {                columnWidth:.2,                layout: 'form',                items: [{                    xtype:'textfield',                    fieldLabel: 'APP',                    name: 'app',                    anchor:'95%'                }]                },*/  {                columnWidth:.2,                layout: 'form',                items:[{                xtype:'textfield',                    fieldLabel: '输入IP',                    name: 'ip',                    anchor:'95%'                }]                },{                columnWidth:.1,                layout: 'form',                items:[new Ext.Button({                text: '查询',                    name: 'submit',                    anchor:'95%',                    id : 'searchbtn',                    handler : function (){                gdProjects.store.reload({params:query.getForm().getValues()});                }                })]                }]            }        ]});


SVR_WIN = new Ext.Window({              title: '选择服务器',              frame: true,           closeAction:'hide',           //closeAction:'close',              closable:true,              width:820,              height:550,           id : 'svrgrid4',              modal:true,              plain:true,              layout: 'border',              listeners : { 'close' : function(){Ext.getBody().unmask();}},              items: [nav, this.searchDataPanel],              buttons : [                   {text:'取消', handler:function(){SVR_WIN.hide();}},                   {                   text:'确定',                   handler:function(){                   selNodes = catTree.getChecked();                   var distdata = [];                   Ext.each(selNodes, function(node){                   if (node.hasChildNodes()) {                   var catno = {category_id:node.id, dist_id: 0};                   distdata.push(catno);                   }else{                   var labeltxt = node.text.split("-");                   var distno = {category_id:labeltxt[0], dist_id:labeltxt[1]};                   distdata.push(distno);                   }                   });                   //InitFormDist                   var ips = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   ips.push(rec.data.ip);                   });                   var app_id = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   app_id.push(rec.data.app_id);                   });                   var main_name = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   main_name.push(rec.data.main_name);                   });                   var sub_name = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   sub_name.push(rec.data.sub_name);                   });                   var app_name = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   app_name.push(rec.data.app_name);                   });                   var prefix = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   prefix.push(rec.data.prefix);                   });                   var dist_id = [];                   Ext.getCmp('svrgrid').getSelectionModel().each(function(rec){                   dist_id.push(rec.data.dist_id);                   });                   var jsonstr = Ext.util.JSON.encode({dist:distdata,ip:ips,app_id:app_id,main_name:main_name,sub_name:sub_name,                     app_name:app_name,prefix:prefix,dist_id:dist_id});                   //var jsonstr = Ext.util.JSON.encode({dist:0,ip:ips});                   //jsonstr = escape(jsonstr);                   Ext.Ajax.request({                      url: '{%url combsvrip %}',                      params: { param : jsonstr },                      success: function(response, options){                   var data = Ext.util.JSON.decode(response.responseText);                   if(data){                   //getCmp('target_ip')                   /*Ext.fgetCmp('target_ip').getValue();                   Ext.fgetCmp('target_ip').getValue(data.ips);                   SVR_WIN.hide();                   Ext.getCmp('target_ip').focus();*/                   simple.items.item(0).setValue('');                   simple.items.item(0).setValue(data.ip);                   simple.items.item(1).setValue(data.prefix +'-'+ data.dist_id +'-'+ data.app_name);                   simple.items.item(2).setValue(data.app_id);                   SVR_WIN.hide();                   simple.items.item(1).focus();                   }else{                   Ext.Msg.alert("操作失败","未能获得任何ip数据,请确认您选了ip并重新操作");                   }                      },                      failure: function(){Ext.Msg.alert("操作失败","可能网络有异常,请重试");}                   });                    }                   }              ]          });


原创粉丝点击