Hybrid View
-
1 Feb 2012 3:17 AM #1
Unanswered: Same ID Component Bug
Unanswered: Same ID Component Bug
I think what I found seems a PR4 bug but would like to confirm if it persist at your side too.
I created a panel under a view like this.
I remove all components and then add this to the view.Code:var video = Ext.create('Ext.Panel', { id : 'jwPlayerContainer', html : '<object type="application/x-shockwave-flash" id="jwplayer" name="jwplayer" data="jwplayer/player.swf" width="480" height="270" style="width: 1286px !important; height: 230px !important; "><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="flashvars" value="file=' + flashvars.file + '&streamer=' + flashvars.streamer + '"></object>' });
My job is to resize the <object> based on its container so I use.Code:this.removeAll(true, true); this.add(video);
My onResizeChange callback.Code:this.sizeMonitor = new Ext.util.SizeMonitor({ element : video.getEl(), callback : this.onSizeChange, scope : this });
When user presses back button and comes again to that view the same panel with object element is added and new sizeMonitor is set. But this time the added panel and object element which was destroyed is returned and not the new one.Code:onSizeChange : function() { var jwPlayer = Ext.get('jwplayer'); var jwPlayerContainer = Ext.get('jwPlayerContainer'); if(jwPlayer && jwPlayerContainer) { console.log(jwPlayer.dom); console.log(jwPlayerContainer.dom); jwPlayer.setWidth(jwPlayerContainer.getWidth()); jwPlayer.setHeight(jwPlayerContainer.getHeight()); } }
Is that a known bug?
-
1 Feb 2012 8:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
When you do this.add... are you recreating the panel?
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.
-
1 Feb 2012 8:13 AM #3
Here's the function that is being called from outside the view. This function is called from other views.
Code:addVideoPlayer : function(url, thumbnail) { //split link into two parts var urlSplitted = url.match(/^(.*)\/([^\/]+)$/); var flashvars = { file : urlSplitted[2], streamer : urlSplitted[1] }; flashvars = { file : 'live', streamer : 'rtmp://fms-live.xstream.dk/bb_live' }; this.remove(this.jwplayer, true); this.jwplayer = Ext.create('Ext.Panel', { id : 'jwPlayerContainer', html : '<object type="application/x-shockwave-flash" id="jwplayer" name="jwplayer" data="jwplayer/player.swf" width="480" height="270" style="width: 1286px !important; height: 230px !important; "><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="flashvars" value="file=' + flashvars.file + '&streamer=' + flashvars.streamer + '"></object>' }); this.add(this.jwplayer); this.sizeMonitor = new Ext.util.SizeMonitor({ element : this.jwplayer.getEl(), callback : this.onSizeChange, scope : this }); this.onSizeChange(); }
-
1 Feb 2012 8:15 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
After removal, have you checked the ComponentManager to see if the id is gone?
Personally, I would only use id for debugging, not production code.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.
-
1 Feb 2012 9:46 AM #5
Ok how can I have access to
ComponentManager? By Ext.ComponentManager? It seems private utility class.
Also why won't you use id? The <object> tag is added to the container as text markup.
-
1 Feb 2012 10:01 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
You are just checking to see if the id was removed for debugging.
I don't use id as you get collisions. ComponentQuery is a much better solution, your app has a hierarchy and can resolve a component based on this.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.


Reply With Quote