Hello together
Can somebody help me to make the following code working in Ext JS 4.1 RC2? I copied the code from here http://www.sencha.com/forum/showthre...panel&p=269519.
Code:
var grid = new Ext.grid.GridPanel({
store: new Ext.data.SimpleStore({
fields: ['a', 'b', 'c'],
data: [
[1, 2, 3],
[2, 3, 4],
[3, 4, 5]
]
}),
columns: [
{header: 'A', dataIndex: 'a', width: 1},
{header: 'B', dataIndex: 'b', width: 1},
{header: 'C', dataIndex: 'c', width: 1}
],
cellPadding: 8,
autoSizeColumn: function(colIndex) {
var w = this.view.getHeaderCell(colIndex).firstChild.scrollWidth;
for (var r = 0, len = this.store.getCount(); r < len; r++) {
w = Math.max(w, this.view.getCell(r, colIndex).firstChild.scrollWidth);
}
w += this.cellPadding;
this.colModel.setColumnWidth(colIndex, w);
return w;
},
viewConfig: {
afterRender: function(){
this.constructor.prototype.afterRender.apply(this, arguments);
this.grid.autoSizeColumn(0);
this.grid.autoSizeColumn(1);
this.grid.autoSizeColumn(2);
}
}
});
new Ext.Viewport({
layout: 'fit',
items: grid
});
Thanks for your support!
Kind regards
extjser12