Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    Pakistan
    Posts
    229
    Answers
    10
    Vote Rating
    1
    umr.ashrf is on a distinguished road

      0  

    Default 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.

    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 + '&amp;streamer=' + flashvars.streamer + '"></object>'
    });
    I remove all components and then add this to the view.
    Code:
    this.removeAll(true, true);
    this.add(video);
    My job is to resize the <object> based on its container so I use.

    Code:
    this.sizeMonitor = new Ext.util.SizeMonitor({
        element : video.getEl(),
        callback : this.onSizeChange,
        scope : this
    });
    My onResizeChange callback.

    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());
        }
    }
    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.

    Is that a known bug?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,032
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    When you do this.add... are you recreating the panel?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Pakistan
    Posts
    229
    Answers
    10
    Vote Rating
    1
    umr.ashrf is on a distinguished road

      0  

    Default


    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 + '&amp;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();
    }

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,032
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Oct 2011
    Location
    Pakistan
    Posts
    229
    Answers
    10
    Vote Rating
    1
    umr.ashrf is on a distinguished road

      0  

    Default


    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.

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,032
    Answers
    3493
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 2