PDA

View Full Version : find panel/layout in which grid resides



sreenija
10 Dec 2007, 2:53 AM
hi!
is there any way to find the GridPanel in which the grid resides
or even the layout in which grid resides

because i want to do layout.setTitle when i click a button in grid's toolbar

i know how to get the grid from the layout object
but i want to know whether we can get the layout in which the grid resides using grid object

ThankYou
Sreenija

fay
10 Dec 2007, 5:26 AM
Try http://extjs.com/deploy/ext/docs/output/Ext.Element.html#up

sreenija
10 Dec 2007, 9:19 PM
Thanks for your reply

but what i want is:

my LayoutDialog is:


layout=new Ext.LayoutDialog("NewDivP"+l, {
modal:false,
draggable:false,
shadow:false,
minWidth:50,
minHeight:50,
proxyDrag:true,
buttonAlign:'left',
constraintoviewport:false,
title:title

center: {
autoScroll:true,
closeOnTab: true,
alwaysShowTabs: false
}
});

var layout1 = layout.getLayout();
layout1.beginUpdate();
layout1.add('center', new Ext.GridPanel(mygrid));
layout1.endUpdate();



like this i have lot many number of dialogs in my page
and my grid has a toolbar with a button that should allow you to change the title of dialog like when i click the button it shows a javascript prompt box asking a new title to be set for the dialog

now i have to take that name and set it as the title for the dialog in which the grid resides

here mygrid is the grid sitting in GridPanel in the center of dialog

like now i should set the title of the dialog(by getting layout object) using grid object

help me please
sreenija

fay
11 Dec 2007, 9:25 AM
Sorry Sreenija, I can't really follow your requirement. The following might be what you're looking for: given a grid name, find its parent dialog and set its title?


var g = Ext.get('my-grid-id');
if (g)
{
var dlg = g.up('div.x-dlg', 1000, true);
if (dlg)
{
dlg = Ext.DialogManager.get(dlg.id);
if (dlg)
dlg.setTitle('asdf');
}
};

Btw, there's bound to be a less-convoluted way of doing this.

sreenija
12 Dec 2007, 1:23 AM
Any way
Thanks for replying Fay