Get this Json reader error via loadexception when adding a column:
Code:f.convert is not a function
Printable View
Get this Json reader error via loadexception when adding a column:
Code:f.convert is not a function
Yes, I just noticed an error in addField. Please try the updated code in the original post.
Hi Condor
Can grid.addColumn method be used to add a CheckBox column?
Thanks
Nik
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();
May be gridPanel.getView().refresh ?
very nice =D>=D>=D>
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
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().
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!!!!!!