PDA

View Full Version : Troubles with dynamically adding a column to a grid with Ext JS 4



scottwalter
9 Feb 2012, 6:23 AM
Hi, I am attempting to dynamically add a column to a grid when a button is pressed via:



Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
handler: function() {
cols = grid.columns;
c = new Ext.grid.Column({text:"My Name",width:100,dataIndex:"myname"});
cols.push(c);
grid.reconfigure(store,cols);
}
});


However when the code is executed the all the headers are gone except for the new one and the new column is not added to the grid.

Any ideas on what I am doing wrong?

mitchellsimoens
9 Feb 2012, 10:48 AM
Moved this to the Ext JS 4 Q&A forum