PDA

View Full Version : Issue in adding html text to a panel



wasima
23 Jul 2013, 9:08 PM
Hi,
To add a html text to a panel i can use html config of panel , but if a panel is already rendered how can i add html to panel,? there is no method like panel.inserthtml('text');


Please Help . Thanks in advance

asankaub
23 Jul 2013, 9:33 PM
you can do like this. you need a give a id to panel and in after render listener do like this.


Ext.get('myPanelID').update('New text');

wasima
23 Jul 2013, 9:51 PM
Thanks Asankaub,

The html text gets updated but panel title bar is lost and color of panel background changes from white to blue .

I want to retain configs of panel even after updating html text.


Thanks .

asankaub
23 Jul 2013, 10:08 PM
what is the version you are using ? i checked with an sample application and its working fine. Please use following code and see.



Ext.getCmp('PanelID').el.update('New text')

wasima
23 Jul 2013, 10:40 PM
This also doesn't work . Same issue is noticed.

asankaub
23 Jul 2013, 10:58 PM
can you put your code here to look into that.

Try the below code also

Ext.getCmp('PanelID').body.update('New text')

wasima
23 Jul 2013, 11:01 PM
viewport.add({
items:[{
xtype:'panel',
layout :'border',
id :'abc',
width : 1000,
height : 1000,
items:[
{
xtype: 'panel',


// id :'tabID',
region:'east',
id :'eastRegion',
title : 'ToolTip',
// collapsible:true,
// html : 'hhhh',
layout:'fit',
margins: '5 0 0 5',
width: 200
//width :500
// html :'<div id="connectivity" style="width: 100%; height: 100%"></div>'
},
{
xtype: 'tabpanel',
id:'tabID',
layout:'fit',
region:'center',
margins: '5 5 0 0'
// title:'hellop'
}


]




}
]
});





var pa = Ext.getCmp('eastRegion');
pa.el.update('hi');



Thanks .

wasima
23 Jul 2013, 11:06 PM
Thanks.
Ext.getCmp('PanelID').body.update('New text') this works.

But how do i clear this html on some change .?

Thanks in advance.

asankaub
23 Jul 2013, 11:10 PM
Put this code inside your panel you need to change the html.


listeners: { afterrender : function(){
this.update('New text');
},
}

asankaub
23 Jul 2013, 11:13 PM
you can clear your html by using an listener in the panel.