Proxy.js 4 KB

Ext.define('App.view.Proxy', {
    extend : 'Ext.grid.Panel',
    xtype  : 'mvvm-ProxyView',
   title : 'Proxy сервера',
    store : 'Proxy',
    
	    tbar: [                     
               {
                 text:'Добавить',
                 margin:'5 5 5 5',
                 handler: function(){
                	
                	 if (winaddproxy==null) {
  		            	 var winaddproxy = Ext.create('widget.window', {     // создание окна
  		            		 	title:'Добавить',
  		            		
  		            		 	maximize: function(){
  		            		 		this.callParent([true]); //animate
  		            		 	},

  		            		 	restore: function(){
  		            		 		this.callParent([true]); //animate
  		            		 	},         
  		                                          
  		            		 	closeAction: 'hide',   
  		            		 	items: [
										{
										      xtype : 'mvvm-DetailProxyView',
										    
										      viewModel : {
										          data : {
										              rec : {
										            	  proxy:"http_proxy='http://user:password@proxyserver:7777'"
										              }
										          }
										      }
										  }
										]
	      		            	});
  		            
  		            	 	winaddproxy.show();
  		            	 }
                	 
                	 
                	 
                 }
          	}]   ,
           
    
    
    columns: [{ 
		            text      : '№',  
		            dataIndex : 'id', 
		            flex: 1
		       },
		       { 
		            text      : 'Proxy сервер', 
		            dataIndex : 'proxy', 
		            flex      : 5
		       },
		        {
      		      xtype: 'actioncolumn',
      		      text      : '#',
      		      flex:1,
      		      dataIndex: 'guid',
      		      items: [{
      		          icon: 'resources/img/tools.png',
      		          handler: function (grid, rowIndex, colIndex) {
      		              var rec = grid.getStore().getAt(rowIndex);
      		              
      		             if (wintoolsproxy==null) {
      		            	 var wintoolsproxy = Ext.create('widget.window', {     // создание окна
      		            		 	title:'Изменить',
      		            		
      		            		 	maximize: function(){
      		            		 		this.callParent([true]); //animate
      		            		 	},

      		            		 	restore: function(){
      		            		 		this.callParent([true]); //animate
      		            		 	},         
      		                                          
      		            		 	closeAction: 'hide',   
      		            		 	items: [
											{
											      xtype : 'mvvm-DetailProxyView',
											      viewModel : {
											          data : {
											              rec : rec
											          }
											      }
											  }
											]
		      		                
      		            	 		});
      		            
      		            	wintoolsproxy.show();
      		            	 }
      		          }
      		      }
      		      ],
     
      		      action: 'tools'
      		  },
      		  {
      		      xtype: 'actioncolumn',
      		      text      : '#',
      		      flex:1,
      		      dataIndex: 'id',
      		      items: [{
      		          icon: 'resources/img/delete.png',
      		          handler: function (grid, rowIndex, colIndex) {
      		        	  
      		        	  
      		        	  
      		        	  
      		        	var selectedRecord = grid.getStore().getAt(rowIndex);
      		        	grid.getStore().each(function(rec) {
      		        	    if (rec == selectedRecord) {
      		        	        grid.store.remove(rec);
      		        	    }
      		        	});
      		        	grid.getView().refresh();
      		        	
      		        	  
      		        	  
      		        	  
      		            
      		          }
      		      }],

      		      action: 'delete'
      		  }
      		  
      		  
      		  
        	]
});