PDA

View Full Version : [CLOSED] Content Update problem



sz_146
Oct 27, 2008, 1:31 PM
I have the following code as part of a border layout in my main.aspx file :





<Center>


<ext:Panel ID="Panel7" runat="server">


<Content>


<div class="content">


<h1>Welcme</h1>


<p>Please use the navigation on the left to browse the site</p>


<p>If you need any help please contact us</p>






</Content>


</ext:Panel>


</Center>



I want to change/update the content the content div from my custom Javascript.






<div class="content">


I am doing :



var a = Ext.getCmp('Panel7').body.dom;
a.innerHTML = '<div class="content"> + somecontent + '
';
Ext.getCmp('Panel1').doLayout();


I want to avoid having to put the wrapper div everytime. Is there a way I can just change what is inside the div. I used the


.firstChild.getElementsByCLassName('content')[0]


But it doesn't work in IE 7. Please help. Thanks

geoffrey.mcgill
Oct 27, 2008, 6:58 PM
Hi sz_146,

If you're are adding html inside the <Content> tags a with a unique ID is automatically created. It might be easiest to just use that and not add another <div class="content"> wrapper.

To get an instance of the <Content> , append the string "_Content" to .ClientID of the Panel.

Once you have an instance of a , use the .update() function to set the innerHTML.

The following code sample demonstrates how to get an instance of the default body and update the content.

Example


Ext.get('Panel1_Content').update('some content here');

With the release of v0.7 we have changed the <Content> tag to <Body> and the above code can be simplified using the following code sample.

Example


Panel1.getBody().update('some content here');

More information re: the switch to <Body> can be found at <A href="http://forums.ext.net/showthread.php?threadid=2938-12-1.aspxHope">http://forums.ext.net/showthread.php?threadid=2938-12-1.aspx

</A>Hope this helps.

sz_146
Oct 29, 2008, 6:55 AM
Sorry for a late reply Geoffery and thanks you.