PDA

View Full Version : Panel not updating HTML



mail2nishant
5 Feb 2010, 7:53 AM
I have a panel like this


new Ext.Panel({

title:'Preview'
,id:'sourceTab'
,iconCls:'icon-ok'
,bodyStyle:'padding:10px'
,autoScroll: true
,html:'test'
})

and i have a function to update its html to put image into it so i have following function but firebug stays body undeifined. any pointers please?



function(){

alert("sourcetab = "+Ext.getCmp('sourceTab'));
//alert("detail tab = "+Ext.get('detailsTab'));
var imgsrc = "./ext-3.0.0/docs/resources/form.png";
var htmlpreview = '<div id="imgdiv" style=float:left;width:120px;><img id="Img" src='+imgsrc+'></img></div>';
alert("htmlpreview = "+Ext.get('htmlpreview'));
//Ext.getCmp('sourceTab').update(htmlpreview);...does not work
Ext.getCmp('sourceTab').body.update(htmlpreview);
Ext.getCmp('tabpanel').setActiveTab(Ext.getCmp('sourceTab'));
}

Thanks.

5 Feb 2010, 8:10 AM
Please use code tags.

5 Feb 2010, 8:12 AM
is it rendered at the time?

the following works:


var x = new Ext.Window({
height : 100,
width : 100
});

x.show();
x.update('asdfasdf')

mail2nishant
5 Feb 2010, 8:16 AM
The window has multiple tabs and multiple htmls so i can't update window.

I want dynamic rendering as it intially set to test and then put image over there.

5 Feb 2010, 8:18 AM
try setting "deferredRender" to false in the tab panel.


It might be better if you clearly explain your problem next time.

mail2nishant
5 Feb 2010, 10:46 AM
this property value set to false helped a lot.

Thanks.