View Full Version : How can I tell a grid to resize itself?
davidascher
9 Mar 2007, 10:52 PM
If I change the container of a grid to be larger or smaller, how can I get the grid to reconfigure its geometry? Using firebug, it seems as though all of the DOM elements have fixed widths and heights. I've tried calling layout and refresh() on the gridview, with no success.
jack.slocum
9 Mar 2007, 11:42 PM
grid.autoSize()
If it's in a BorderLayout, you can put it in a GridPanel and it will manage it for you.
brian
10 Mar 2007, 3:57 AM
If it's in a BorderLayout, you can put it in a GridPanel and it will manage it for you.
This is one of the best features. All of the different components lock together like Voltron!
dbadke
12 Mar 2007, 7:42 AM
What if the grid is in a TabPanel? Can a GridPanel live in a TabPanel? See the sadly unanswered :( thread http://www.yui-ext.com/forum/viewtopic.php?t=3613.
Animal
12 Mar 2007, 7:55 AM
I have grids in GridPanels which, when added to a Region become tabs.
dbadke
12 Mar 2007, 10:10 AM
Thanks, but not quite the problem... I have a TabPanel in a ContentPanel in a BorderLayout, and a grid in one of the TabPanel's pages (not directly in the ContentPanel). I want that grid in a GridPanel, but can't figure out how to get it there. A TabPanel has no region to add a GridPanel to...
Belgabor
12 Mar 2007, 10:17 AM
Well, as a work-around you could replace the ContentPanel (which ocntains the TabPanel) with a NestedLayoutPanel and add a GridPanel (and your other tabs as ContentPanels) to the center region of that.
kjordan
12 Mar 2007, 10:18 AM
Thanks, but not quite the problem... I have a TabPanel in a ContentPanel in a BorderLayout, and a grid in one of the TabPanel's pages (not directly in the ContentPanel). I want that grid in a GridPanel, but can't figure out how to get it there. A TabPanel has no region to add a GridPanel to...
Why go through that much trouble? Just add a panel to a region and it'll automatically tab.
tryanDLS
12 Mar 2007, 10:22 AM
I haven't tried this, but can't you just add a GridPanel to the TabPanelItem? I don't think it has to be a region. I'm guessing you're manually handing the TabPanelItem resizing, so you could just tell the gridpanel to resize to it's container??
jack.slocum
12 Mar 2007, 10:32 PM
TabPanel does not have the layout code required to resize a grid. A BorderLayout can though and can be used as a drop in replacement for a TabPanel. Just render the layout to the same element you were going to render the tabs to and use a single center region. Add a GridPanel to one of the tabs.
dbadke
13 Mar 2007, 7:05 AM
I had considered using a border layout, but I was concerned about the overhead. My page already has multiple nested layouts, and I was reluctant to add more. I'll give it a try when I get time, and see what happens.
grid.autoSize()
If it's in a BorderLayout, you can put it in a GridPanel and it will manage it for you.
but It show "is not a function",and I can't find this method in the api of ext-rc1?
what's wrong?
tryanDLS
28 Nov 2007, 8:39 AM
but It show "is not a function",and I can't find this method in the api of ext-rc1?
what's wrong?
autoSize is a 1.x function, you could try syncSize in 2.0.
This thread actually should have been moved to the 1.x forum. If you still have problems, please post a new thread in 2.0 Help.
janixams
2 Jun 2008, 4:49 PM
TabPanel does not have the layout code required to resize a grid. A BorderLayout can though and can be used as a drop in replacement for a TabPanel. Just render the layout to the same element you were going to render the tabs to and use a single center region. Add a GridPanel to one of the tabs.
I have a similar problem with tabPanel and grid. (Forgive my English please)
I have a borderLayout with north, south, west and east region. In th east region I have a gridPanel with a grid. This content is put in the region by contentPanel load method.
This grid have a footerPanel, wich I can't to see when I show the page in the browser, because this footerPanel render under south region titleBar. (I change the south region height and I can see the footerPanel)
What I am doing wrong? :((
If I collapse the south region, I can see the footerPanel but the grid doesn't cover the left over space in east region.
Otherwise, I have a toolBar in this region too and the footerPanel appear when I remove this toolBar from east region.
This are my questions:
1- Why the grid not adjusts its size when the region is collapsed?
2- Why I can't see the footerPanel?
Some code here...
[PHP]
var Plantilla = function(){
return {
init :function(){
var valores = [
['Fulanito de tal','analista']
];
var plantilla_store = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(valores),
reader: new Ext.data.ArrayReader({}, [
{name: 'nombreP'},
{name: 'rol'}
])
});
plantilla_store.load();
var plantilla_colModel = new Ext.grid.ColumnModel([
{
id:'nombreP',
header: "Nombre y Apellidos",
width: 200,
sortable: true,
dataIndex: 'nombreP',
},
{
header: "Rol",
width: 190,
sortable: true,
dataIndex: 'rol'
}
]);
plantilla_colModel.defaultSortable = true;
plantilla_store.setDefaultSort('nombreP', 'asc');
var plantilla_grid = new Ext.grid.Grid('grid_plantilla', {
ds: plantilla_store,
cm: plantilla_colModel,
autoExpandColumn: 'nombreP',
enableColLock:false
});
var plantilla_layout = Ext.BorderLayout.create({
center: {
margins:{left:3,top:3,right:3,bottom:3},
panels: [new Ext.GridPanel(plantilla_grid)]
}
}, 'grid_contenedor');
plantilla_grid.render();
plantilla_grid.on('rowdblclick', function(){
alert('se muestra la ficha de la persona');
});
var plantilla_Footer = plantilla_grid.getView().getFooterPanel(true);
var paging = new Ext.PagingToolbar(plantilla_Footer, plantilla_store, {
pageSize: 14,
displayInfo: true,
beforePageText :'P
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.