-
20 Feb 2009 7:07 PM #11
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
-
20 Feb 2009 11:56 PM #12Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Yes, I just noticed an error in addField. Please try the updated code in the original post.
-
25 Mar 2009 9:10 PM #13
Hi Condor
Can grid.addColumn method be used to add a CheckBox column?
Thanks
Nik
-
26 Mar 2009 12:54 AM #14
-
15 Apr 2009 5:01 AM #15
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();
-
15 Apr 2009 5:34 AM #16
May be gridPanel.getView().refresh ?
-
15 Apr 2009 5:43 AM #17
-
15 Apr 2009 5:51 AM #18
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
-
15 Apr 2009 6:21 AM #19Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
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().
-
15 Apr 2009 6:54 AM #20
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...
By the way, still having a problem, when adding columns after the first one... the grid records are only show for the first column...Code:removeColumn: function(colIndex) { var config = this.config; config.remove(config[colIndex]); }
thanks very much!!!!!!


Reply With Quote

