PDA

View Full Version : Clearing the content of a panel, which is rendered on another panel



kislay.kishore
11 Jan 2012, 12:34 AM
I have two questions:
1. How to clear the content which is rendered on rawDataContainer and chartContainer. My code for the panel (with border layout ) is as below.

2. I am using 'rawDataContainer-body' and 'chartContainer-body' and passing it in renderTo of concered chart and grid panel. I found in firebug, that ExtJS creates such div (panelId-div) . This doesnt seems to best practice to me. Is there any other way to get these div Ids?

Please suggest. Thanks!

var myPanel = Ext.create('Ext.panel.Panel', {
height: 800,
title: 'HomePage',
layout: 'border',
defaults: {
collapsible: true,
split: true,
bodyStyle: 'padding:15px'
},
items: [{
title: 'Raw Data',
id: 'rawDataContainer',
region: 'south',
xtype: 'panel',
//layout: 'fit',
height: 300,
split: true,
margins: '0 5 5 5'
},{
title: 'Input',
region:'west',
xtype: 'panel',
margins: '5 0 0 5',
height: 500,
width: 450,
collapsible: true,
collapseDirection: 'top',
id: 'inputContainer',
layout: 'fit'
},{
title: 'Chart',
region: 'center', // center region is required, no width/height specified
xtype: 'panel',
layout: 'fit',
height: 500,
margins: '5 0 0 0',
id: 'chartContainer',
}],
renderTo: 'pageDiv'
});

manoj123
11 Jan 2012, 12:52 AM
How about the following code?



var rawDataPanel = Ext.getCmp('rawDataContainer');
rawDataPanel.removeAll();

kislay.kishore
11 Jan 2012, 1:11 AM
It doesnt work. However, I didint get any error either...
How about the following code?

var rawDataPanel = Ext.getCmp('rawDataContainer');rawDataPanel.removeAll();

manoj123
11 Jan 2012, 1:44 AM
Also add the following line at the end.


rawDataPanel.doLayout();

If that doesn't work, can you try printing out rawDataPanel to console and check in firebug?

kislay.kishore
11 Jan 2012, 2:06 AM
It doesnt remove. On cosole, it does show two objects for rawDataPanel on firing the request for the second time.:(

I went thru the code for removeAll() , wondering why this code is not working, although it seems to be correct!

kislay.kishore
11 Jan 2012, 2:17 AM
Did you read my second question? Can it cause the issue here?