PDA

View Full Version : Fire on Panel



olriche38
3 Feb 2010, 4:13 AM
Hello

I didn't find how can I know when a panel is draw or show.

I tryed:

mypanel.on('show', function(){alert('Show');});

Drayton
3 Feb 2010, 4:44 AM
The 'show' event only fires when you actually call the panels show() method.

This will make the panel render, but will not trigger the show event:

new Ext.Panel({
renderTo: document.body,
title: 'test',
width: 400,
height: 400,
listeners: {
show: function(){
_log('show');
}
}
});
This will render the pannel hidden and the subsequent call to show() will trigger the show event:

var w = new Ext.Panel({
renderTo: document.body,
title: 'test',
width: 400,
height: 400,
hidden: true,
listeners: {
show: function(){
_log('show');
}
}
});

w.show();Maybe 'render' is the event you're looking for?

olriche38
3 Feb 2010, 7:14 AM
thx, but in fact I have this code :

var vecteurGraphPanel = new Ext.Panel({
height: 800,
autoWidth: true,
border: false,
// style: { "margin": "10px 10px 10px 10px" },
html: '<div id="vecteurGraph" style="width:1400px;height:600px;"></div>',
renderTo: Ext.getBody(),
tbar: ['-'],
listeners: {
render: function(){
alert(this.width);
}
}

});

the alert says undefined. Because I would like to know the width of my panel.