PDA

View Full Version : Grid view height is too big



fily55
26 Jul 2012, 3:04 AM
Hi Guys,

I have created an xtype which is a window. I then create a grid which is put into the items of this window. For some reason the grid view height is too big. The height of the grid is 250 and the height of the grid height is 248. Any ideas? Here is some of the code:



initComponent : function(){
var me = this;
grid = me.createGrid();
buttons = me.createButtons(),
title = me.generateTitle();

Ext.QuickTips.init();
me.items = grid;

me.fbar = {
xtype : "toolbar",
items : buttons
};

me.callParent(arguments);

me.setTitle(title);

}


createGrid : function() {
var me = this,

store = me.createStore(),
columns = me.columns,
topBar = me.createTopBar(),

grid = Ext.create("Ext.grid.Panel", {
forceFit : true,
columns : columns,
autoScroll : true,
height : 250,
store : store,
tbar : topBar

);

return grid;
}

Also tried to manually set the height of the view in the config of the grid but no joy.

fily55
26 Jul 2012, 3:21 AM
Never mind. This has been solved by applying a maxHeight to the view config. Still don't know what caused it but at least it's fixed.

scottmartin
26 Jul 2012, 1:55 PM
Few comments on your code:



var me = this; <<- should be comma, now grid,buttons,title are global
grid = me.createGrid();
buttons = me.createButtons(),
title = me.generateTitle();

Ext.QuickTips.init(); <<- place this in onReady in main code block
me.items = grid;

me.fbar = {
xtype : "toolbar",
items : buttons
};

me.callParent(arguments);
me.setTitle(title);




var me = this,

store = me.createStore(),
columns = me.columns,
topBar = me.createTopBar(),

grid = Ext.create("Ext.grid.Panel", {
forceFit : true, <<- use flex in your fields instead;
columns : columns,
autoScroll : true, <<- not useful, grid handles scroll auto
height : 250,<<- dump .. use 'fit' in your parent container as layout
store : store,
tbar : topBar
);



Regards,
Scott.