1. #1
    Ext User iTzAngel's Avatar
    Join Date
    Dec 2007
    Location
    Lima - Peru
    Posts
    65
    Vote Rating
    0
    iTzAngel is on a distinguished road

      0  

    Default Help, problems with grid layout

    Help, problems with grid layout


    Hi there, somebody have add buttons to a grid using TBar?, im using Ext.ux.search plugin, thanks in advance!
    Attached Images

  2. #2
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    perhaps it would help to see some code, tho it looks like a layout issue.

  3. #3
    Ext User iTzAngel's Avatar
    Join Date
    Dec 2007
    Location
    Lima - Peru
    Posts
    65
    Vote Rating
    0
    iTzAngel is on a distinguished road

      0  

    Default code

    code


    Here is,

    Code:
    
    Ext.BLANK_IMAGE_URL = '../../../../../Frameworks/Extjs/2.1/resources/images/default/s.gif';
    Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
    
    
    Ext.onReady(function(){
            Ext.QuickTips.init();
           
            createPacienteGrid();
    
        });
            
     function createPacienteGrid(){
     	
             paciente = Ext.data.Record.create([
    	        {name: 'codigopaciente', mapping: 'codigopaciente',type:'codigopaciente'},
    	        {name: 'dni'},
    	        {name: 'nombres'},
    	        {name: 'apellidos'},
    	        {name: 'sexo'},
    	        {name: 'fechanace', type: 'date', dateFormat: 'd/m/Y'},
    	        {name: 'telefono'},
    	        {name: 'celular'},
    	        {name: 'email'},
    	        {name: 'nacionalidad'},
                {name: 'direccion'}
            ]);
            
    	     pacienteReader = new Ext.data.JsonReader(
    	            {
    	            totalProperty : 'pacientes', root : 'pacientes', id : 'codigopaciente'},
                    paciente
    		        );
    		
           var ds = new Ext.data.Store({
    	        proxy: new Ext.data.HttpProxy({
    	   		    url: 'Busqueda'
    	        }),   
    	        reader: pacienteReader,  
    		    remoteSort: true,
                baseParams: {start:0, limit:100}
    
            }); 
            ds.setDefaultSort('codigopaciente','DESC');
            
    		var chksm =  new Ext.grid.CheckboxSelectionModel({singleSelect:true});
            
            columnModel = new Ext.grid.ColumnModel([chksm,{
    			id: 'codigopaciente',
    			header : "Codigo Paciente",
    			dataIndex : 'codigopaciente',
    			width : 120,
    			sorteable : true
    		},{ 
    		    header: 'Dni',
    		    dataIndex: 'dni',
    		    width: 90,
    		    sorteable: true		
    		},{
    			header : 'Nombres',
    			dataIndex : 'nombres',
    			width : 120,
    			sorteable : true
    		}, {
    			header : 'Apellidos',
    			dataIndex : 'apellidos',
    			width : 120,
    			sorteable : true
    		}, {
    			header : 'Telefono',
    			dataIndex : 'telefono',
    			width : 120,
    			sorteable : true
    		}, {
    			header : 'Email',
    			dataIndex : 'email',
    			width : 120,
    			sorteable : true
    		}, {
    			header : 'Nacionalidad',
    			dataIndex : 'nacionalidad',
    			width : 120,
    			sorteable : true
    		}, {
    			header : 'Direccion',
    			dataIndex : 'direccion',
    			width : 120,
    			sorteable : true
    		},{
                header : 'Celular',
    			dataIndex : 'celular',
    			width : 120,
    			sorteable : true
    		},{
                header : 'Fecha de Nacimiento',
    			dataIndex : 'fechanace',
    			width : 120,
    			sorteable : true
    		}
    			
    		]);
    		columnModel.defaultSortable = true;
    		
            searchPlugin = new Ext.ux.grid.Search({
    			minChars : 2,
    			autoFocus : true
    		});
     	
     		
    		 var pacientesGrid = new Ext.grid.GridPanel({
    	      	singleSelect:true,
    			layout : 'fit',
    			border : false,
                store: ds,
                cm: columnModel,
                sm: chksm  
                ,
    			bbar:new Ext.PagingToolbar({
                    store: ds,
    //                load: {params:{start:0, limit:100}},
    	            pageSize: 100,            
    	            displayInfo: true,
    	            displayMsg: 'Displaying topics {0} - {1} of {2}',
    	            emptyMsg: "No topics to display"
    			}),
    		    viewConfig: {
                forceFit:true
                },
    			buttons: [{text:'Seleccionar'},{text:'Cancelar'}],
    			buttonAlign:'left',
    			tbar:[{
    			    text:'Nuevo',
    			    tooltip: 'Registra un nuevo paciente',
    			    iconCls: 'add'			
    			}, '-', {
    			    text:'Options',
                    tooltip:'Blah blah blah blaht',
                    iconCls:'option'			
    			}],
    
    			plugins:[new Ext.ux.grid.Search({
                     mode:'local'
                    ,iconCls:false
                    ,dateFormat:'d/m/Y'
    				,iconCls : 'icon-zoom'
    				,minChars : 2
    				,autoFocus : true
            	})]
    			
    		});		
    
        		ds.load({params:{start:0, limit:100}});
    	
                var win = new Ext.Window({
                     width:640
                    ,id:'winid'
                    ,height:480
                    ,plain:true
                    ,layout:'fit'
                    ,border:true
                    ,maximizable:true
                    ,stateful:true
                    ,modal:true        
                    ,closable:true
                    ,title:'Busqueda de Pacientes'
                    ,items:[pacientesGrid]
                });
                win.show();	
    		
     }

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    do not provide a 'layout' config option to gridPanel.

  5. #5
    Ext User iTzAngel's Avatar
    Join Date
    Dec 2007
    Location
    Lima - Peru
    Posts
    65
    Vote Rating
    0
    iTzAngel is on a distinguished road

      0  

    Default


    i delete it and nothing changes, i remove paging toolbar and layout works perfect, but i need it

  6. #6
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    I am not familiar with that search plugin, but i have to wonder if it is conflicting with the bbar that paginToolbar creates. if your remove the plugin, does the grid work properly (with paging bar)?

  7. #7
    Ext User iTzAngel's Avatar
    Join Date
    Dec 2007
    Location
    Lima - Peru
    Posts
    65
    Vote Rating
    0
    iTzAngel is on a distinguished road

      0  

    Default


    viceversa, when i remove the paging bar, the grid works, letse why in jsakalos ext.ux, grids works having the previous related items... =/

Thread Participants: 1