PDA

View Full Version : change Ext.Panel header style dynamic



Snaker
7 May 2010, 10:06 AM
Hi all,

I must update the background-image of a header.

I know how i can change/add a style to the whole panel but not only for his header.

Somthing like:
panel.getHeader().getEl().setStyle('background-image', '...');

The Problem is that the background-image url will create dynamic in the browser, thats why I can not use css class.

Greetings
Snaker

gevik
7 May 2010, 1:46 PM
Hi,

Study the code below:




/* test panel */
var panel = new Ext.Panel({
id:'mypanel',
width:320,
height:320,
title:'test1',
renderTo:Ext.getBody()
});

/* the header is the first div element in a panel.
* so we have to find it first
*/
var header = Ext.get(panel.getEl().dom.children[0].id);

/* then we change the styles the element found above */
header.applyStyles("background-image:url(/path/to/my/image)");
I hope this helps.

Snaker
10 May 2010, 12:29 AM
Works great.

Thanks for the help.
You save my day