PDA

View Full Version : changing a panel's bodyCfg



TheMonolith
17 Mar 2010, 3:56 AM
I have defined a panel with the bodyCfg config option ot display a background image:


var previewPanel = new Ext.Panel(
{
title: 'Vorschau',
iconCls: 'magnifierIcon',
id: 'previewPanel',
width: getTitleBarWidth(previewImagePath, 400, 600),
height: 600,
border: false,
bodyCfg:
{
tag: 'div',
html: '<img src=' + previewImagePath + ' style=\'max-width:400px; max-height: 600px;\'>'
},
plugins: new Ext.ux.DataTip
({
html: '<div>' + toolTipTexts["previewPanel"] + '</div>'
}),
x: 50,
y: 50
});

Now I want to change that background image, but I don't know why because there is no "setBodyCfg" method. So I guess it has to be done using the public body property, however I haven't found an example for that yet.

Your help is greatly appreciated.

Animal
17 Mar 2010, 4:44 AM
there's examples of DOM manipulation everywhere

TheMonolith
17 Mar 2010, 6:25 AM
After reading old threads for 20 years, I found this solution:

Ext.getCmp('previewPanel').body.update(newHtml);

It works.

Animal
17 Mar 2010, 8:08 AM
Oh. Instead of just thinking. "Hmm. The body property. The API docs tell me it is an Ext.Element, and kindly provide a link to it. I'll follow it and see what methods it provides"? Hmm?

Why is is that nowadays people insist on having information looked up for them from primary sources, and then copied and pasted into forums? Or on copy/pasting code they do not fully understand?

What happened before there were web forums?

I'll tell you.

This: http://i131.photobucket.com/albums/p286/TimeTrialAnimal/grey-wall.jpg

The famed VMS "grey wall". The font of all wisdom for a VMS developer.

This is how I cut my teeth in developing.

Back then, if you didn't know how to do something, you didn't buy a chatty book, that treated you like a pal, and persuaded you to learn. You read the manual which was written in technical language to impart correct information.

Comprehending texts like that is a dying art.

People have got too used to no documentation, and just cobbling information together from "teh interwebs".

sosy
27 Aug 2010, 1:45 PM
Hello Animal,

i am working with Ext now for 5 weeks, and managed to find almost everything by myself by reading, reading, reading.

You maybe making an point that it is way tooo easy to post an question in here. That could be true..

BUT! And now i am speaking for myself, probably for a lot of other users too, you happend to be
grown up with english as your mother-tongue. I did not! I learned english in school when i was aged 12.

So it is easy for you to understand everything written here, but we could view it from another perspective.

I am happy to speak 5 languages, how about you?

I am seeking for an solution for over 2 hours, and bumped into this post, after i have read
many, many many posts, and with a lot of animal answers in it.


RTFM..


You maybe right, but i can tell you, thats sometimes it is difficult to find the right search criteria,
especially when you are an starter and english is not your native language.

In the beginning i thought he is right, but this post with the picture of an old-dated hooked up room
with some stuff in it, did it to me.

This forum is here to help each other, and not to play an school master.

Sorry, for this post, but it has to do with respect.

If you have the opinion that this user's question is rubbish, skip to the next post, no one is
asking you for such an answer.

I needed to say this, no hard feelings.

Regards
Sosy