-
10 Nov 2011 1:47 PM #1
Answered: Empty Panel Contents
Answered: Empty Panel Contents
Hello,
I am trying to completely empty the contents of a panel. I cannot for the life of me seem to figure out how. I know there has to be a way...
-
Best Answer Posted by hendricd
@drjames--
The visible portion of a Panel is it's body.
Target your chart to render there:
Then, the Panel.update method should work better:Code:// Create and draw the visualization. var ac = new google.visualization.ComboChart(Ext.getCmp('pChart').body.dom );
Code:Ext.getCmp('pChart').update(''); //clear out the body
-
11 Nov 2011 7:03 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
What do you mean "contents"? To remove all items, do panel.removeAll(). To remove HTML, do panel.update('')
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Nov 2011 6:08 AM #3
Well, the contents is a Google Visualization Chart. Simply put, it's an iframe. Update() does not clean it out. I have tried every method that even remotely resembles something that could clean it out and nothing works.
-
14 Nov 2011 7:04 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
Just tried this and it removes the iframe:
Code:var panel = Ext.create('Ext.panel.Panel', { renderTo : Ext.getBody(), width : 400, height : 400, title : 'Test', html : '<iframe src="http://www.sencha.com/" width="100%" height="100%"></iframe>', dockedItems : [ { xtype : 'toolbar', docked : 'top', items : [ { text : 'Empty', handler : function() { panel.update(''); } } ] } ] });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Nov 2011 11:43 AM #5
Well, the panel has an id of "pChart". Would I be doing it wrong if I were trying it like
Code:Ext.getCmp('pChart').update('');
-
14 Nov 2011 12:48 PM #6
-
14 Nov 2011 12:52 PM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
I wouldn't rely on setting the id config as that will lead to id collisions. ComponentQuery is very powerful and robust.
There is no difference in these two lines:
The first line is called chaining and is valid JavaScript. It is up to the author if he/she wants to use chaining or not.Code:Ext.getCmp('pChart').update(''); var cmp = Ext.getCmp('pChart'); cmp.update('');Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Nov 2011 1:43 PM #8
Just an FYI, I still cannot get this to work. Perhaps it is because the object inside the panel is built and controlled by the Google Visualization object? If so, how do I clear the chart?
-
17 Nov 2011 11:02 AM #9Sencha User
- Join Date
- Oct 2010
- Location
- Brazil - MG, Belo Horizonte
- Posts
- 62
- Vote Rating
- 0
- Answers
- 4
I think you're using the border layout, if i'm correct, you have an problem there, i had it too. you can't use panel.update('') or panel.removeAll() on it, i don't know why at shure, but it's an system rule.
What you will need to do its add an new panel inside the border panel that you wanna to delete the content, so, if ou do this, you will can remove all HTML from it.
Also, try to look the card panel, maybe it can work for you, i'm using it as my layout base and the border layout, i append to it loading it dynamic...

-
22 Nov 2011 9:27 AM #10
@wallynm - I have attempted to do what you said and that still does not delete the Google Visualization. I have also tried several different panel types. Nothing seems to get rid of it.


Reply With Quote