PDA

View Full Version : Grid child columns not resizing.



jedpotter
4 Nov 2013, 7:22 AM
Hi

I am using ExtJs 4.2.1 and all my attempts to get the child columns of a grid to resize (or even initially layout correctly) when the window resizes have failed. The grid works fine for normal columns. Please help.
Below is a small example illustrating my problem.
Thanks



Ext.onReady(function() {
Ext.define('Record', {
extend : 'Ext.data.Model',
fields : [ {
'name' : 'name'
}, {
'name' : 'type'
}, {
'name' : 'a',
type : 'int'
}, {
'name' : 'b',
type : 'int'
}, {
'name' : 'c',
type : 'int'
}, {
'name' : 'd',
type : 'int'
}, {
'name' : 'e',
type : 'int'
}, ]
});
var store = Ext.create('Ext.data.Store', {
storeId : 'RecordStore',
model : 'Record',
data : {
items : [ {
name : "Record One",
type : "One",
a : 1,
b : 2,
c : 3,
d : 4,
e : 5
}, {
name : "Record Two",
type : "Two",
a : 10,
b : 20,
c : 30,
d : 40,
e : 50
}, {
name : "Record Three",
type : "Three",
a : 11,
b : 12,
c : 13,
d : 14,
e : 15
} ]
},
proxy : {
type : 'memory',
reader : {
type : 'json',
root : 'items'
}
}
});
var grid = Ext.create('Ext.grid.Panel', {
renderTo : Ext.getBody(),
title : 'SimpleGrid',
store : store,
enableLocking : true,
columns : [ {
text : 'Name',
width : 100,
locked : true,
dataIndex : 'name'
}, {
text : 'Type',
width : 50,
locked : true,
dataIndex : 'type'
},
{
text : 'Parent',
flex : 5,
columns : [
{
text : 'A',
flex : 1,
dataIndex : 'a'
}, {
text : 'B',
flex : 1,
dataIndex : 'b'
}, {
text : 'C',
flex : 1,
dataIndex : 'c'
}, {
text : 'D',
flex : 1,
dataIndex : 'd'
}, {
text : 'E',
flex : 1,
dataIndex : 'e'
} ]
} ]
});

Ext.EventManager.onWindowResize(function () {
grid.doComponentLayout();
});

});

Gary Schlosberg
14 Nov 2013, 8:38 AM
Looks like it's a known issue:
http://www.sencha.com/forum/showthread.php?274106

The bug ticket is still unresolved at this time.