1. #11
    Sencha User mysticav's Avatar
    Join Date
    Mar 2007
    Location
    Mexico
    Posts
    474
    Vote Rating
    5
    mysticav is on a distinguished road

      0  

    Default


    Get this Json reader error via loadexception when adding a column:

    Code:
    f.convert is not a function
    Using Ext with cachefly
    Working on LAMPExt

  2. #12
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Yes, I just noticed an error in addField. Please try the updated code in the original post.

  3. #13
    Sencha Premium Member
    Join Date
    May 2007
    Posts
    57
    Vote Rating
    0
    tchitani is on a distinguished road

      0  

    Default


    Hi Condor

    Can grid.addColumn method be used to add a CheckBox column?

    Thanks
    Nik

  4. #14
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Quote Originally Posted by tchitani View Post
    Can grid.addColumn method be used to add a CheckBox column?
    Yes, but because you didn't specify it as a plugin for the grid you will also need to call:
    Code:
    gridPanel.getView().mainBody.on('mousedown', checkColumn.onMouseDown, checkColumn);

  5. #15
    Sencha User
    Join Date
    Dec 2008
    Posts
    17
    Vote Rating
    0
    revortado is on a distinguished road

      0  

    Default


    Hi Condor... i having a problem using the code you provide...

    When removing a column, the grid doesn't refresh... the column is still there but the fields of the store are destroyed...
    Is there anything i have missing from my code?

    Try to use the code on a normal grid... below is my code:

    Code:
    // Store de valores
    				    var store = new Ext.data.Store({
    						proxy: new Ext.data.HttpProxy({
    							url: 'php-grid-group.php',
    							method: 'POST'
    						}),
    						reader: new Ext.data.JsonReader({
    							id: 'id',
    							root: 'INDUSTRIA',
    							totalProperty: 'TOTAL',
    							fields: [
    					           {name: 'company'},
    					           {name: 'price', type: 'float'},
    					           {name: 'change', type: 'float'},
    					           {name: 'pctChange', type: 'float'},
    					           {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'},
    					           {name: 'excerpt'},
    					           {name: 'industry'}
    					        ]
    						})
    				    });
    					
    			    
    				    // Colunas de registros		
    				    var cm = [
    				    	{id:'company', header: "Company", width: 160, sortable: true, dataIndex: 'company'},
    		         		{header: "Price", width: 75, sortable: true, dataIndex: 'price'},
            		    	{header: "Change", width: 75, sortable: true, dataIndex: 'change'},
    	    	        	{header: "% Change", width: 75, sortable: true, dataIndex: 'pctChange'},
    		            	{header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('d/m/Y'), dataIndex: 'lastChange'},
    		            	{header: "Industry", width: 85, sortable: true, hidden: true, dataIndex: 'industry'}
    				    ];
    				    
    				    
    					var filters = new Ext.grid.GridFilters({
    					  filters:[
    					    {type: 'string', dataIndex: 'company'},
    					    {type: 'numeric', dataIndex: 'price'},
    					    {type: 'numeric', dataIndex: 'change'},
    					    {type: 'date', dataIndex: 'lastChange'}
    					]});
    					
    				    
    				    // Barra superior de menu de botões
    				    var barSup = [
    			        	{
    							text: 'Voltar',
    							tooltip: 'Voltar',
    							icon: 'back.png',
    							cls:'x-btn-text-icon',
    							handler : function() {
    								grid.removeColumn('company', 'company');
    								grid.getView().refresh(true);
    							}
    						}, {
    							text: 'Novo',
    							tooltip: 'Criar no Item',
    							icon: 'add.png',
    							cls:'x-btn-text-icon'
    							//handler : handleAdicionar
    						}, {
    							text: 'Editar',
    							tooltip: 'Editar Registro Selecionado',
    							icon: 'edit.png',
    							cls:'x-btn-text-icon'
    							//handler : handleAdicionar
    						}, {
    							text: 'Remover',
    							tooltip: 'Remover Selecionado(s)',
    							icon: 'remove.png',
    							cls:'x-btn-text-icon'
    							//handler : handleAdicionar
    						}
    					];
    				    
    				    
    					// create the Grid
    				    var grid = new Ext.grid.GridPanel({
    				    	id: 'grid',
    				        store: store,
    				        columns: cm,
    				        tbar: barSup,
    						renderTo: document.body,
    				        plugins: [filters],
    				        stripeRows: true,
    				        autoExpandColumn: 'company',
    				        height: 350,
    				        width: 600,
    				        bbar: new Ext.PagingToolbar({
    							store: store,
    							pageSize: 10,
    							plugins: [filters]
    						})
    				    });
    					
    					store.load();

  6. #16
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default


    May be gridPanel.getView().refresh ?

  7. #17
    Sencha Premium Member ajaxvador's Avatar
    Join Date
    Nov 2007
    Location
    PARIS, FRANCE
    Posts
    206
    Vote Rating
    0
    ajaxvador is on a distinguished road

      0  

    Default


    very nice
    Vador

  8. #18
    Sencha User
    Join Date
    Dec 2008
    Posts
    17
    Vote Rating
    0
    revortado is on a distinguished road

      0  

    Default


    Already try that galdaka... and do nothing...
    The problem affects when i'm adding a new column... only the first column insert show the records, the others do show nothing...

    Sure i'm missing something...

    thanks in advance

  9. #19
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Sorry, removeColumn was wrong. Could you try again with the updated code from the first post?

    ps. It's removeColumn('company') (no second argument required) and you don't need to call getView().refresh().

  10. #20
    Sencha User
    Join Date
    Dec 2008
    Posts
    17
    Vote Rating
    0
    revortado is on a distinguished road

      0  

    Default


    Hi condor... will try the new code that you work for on the removeColumn method...
    By the way, after try i could solve myself... realize that the function was not removing the column because the remove method was not getting the object...

    So i rewrite your code for my personal use only... hope you don't mind... and i'm sharing with you...
    Thanks again for the support, i'm only beginning explore Ext...

    Code:
    					removeColumn: function(colIndex) {
    						var config = this.config;
    						config.remove(config[colIndex]);
    					}
    By the way, still having a problem, when adding columns after the first one... the grid records are only show for the first column...

    thanks very much!!!!!!