Hybrid View

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    0
    phamtieugiao is on a distinguished road

      0  

    Default down(String selector) method from Container class is not working anymore

    down(String selector) method from Container class is not working anymore


    For example I have a panel "view" that contains a button with ID myButton.
    In touch 1 and touch 2 pr1, I can select the button with view.down('#myButton')

    The down method works in touch 2 pr1, but it doesn't any more in pr2 or pr3.
    Is there any alternatives in new versions?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Vote Rating
    859
    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


    Works for me in PR3:

    Code:
    var cnt = Ext.create('Ext.Container', {
        fullscreen : true,
        items      : [
            {
                xtype  : 'button',
                itemId : 'myButton',
                text   : 'Test'
            },
            {
                xtype  : 'toolbar',
                docked : 'top',
                items  : [
                    {
                        xtype  : 'button',
                        itemId : 'myButton',
                        text   : 'Hello'
                    }
                ]
            }
        ]
    });
    
    console.log(cnt.down('#myButton'));
    console.log(cnt.down('toolbar #myButton'));
    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
    Posts
    127
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Default


    I ran into this exact issue with PR3. Something has changed. I fixed it by not using this.down() in my custom view but using down() on a specific element like Mitchell pointed out above.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Vote Rating
    859
    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


    Quote Originally Posted by robl View Post
    I ran into this exact issue with PR3. Something has changed. I fixed it by not using this.down() in my custom view but using down() on a specific element like Mitchell pointed out above.
    Not element... component
    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
    Posts
    127
    Vote Rating
    0
    robl is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Not element... component
    Yes, I meant "component" but wrote "element". Thanks.

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    0
    phamtieugiao is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Works for me in PR3:

    Code:
    var cnt = Ext.create('Ext.Container', {
        fullscreen : true,
        items      : [
            {
                xtype  : 'button',
                itemId : 'myButton',
                text   : 'Test'
            },
            {
                xtype  : 'toolbar',
                docked : 'top',
                items  : [
                    {
                        xtype  : 'button',
                        itemId : 'myButton',
                        text   : 'Hello'
                    }
                ]
            }
        ]
    });
    
    console.log(cnt.down('#myButton'));
    console.log(cnt.down('toolbar #myButton'));
    What I see different here is the itemId keyword, I thought it was previously id instead.
    Can you explain more about the change?

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,220
    Vote Rating
    859
    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


    Quote Originally Posted by phamtieugiao View Post
    What I see different here is the itemId keyword, I thought it was previously id instead.
    Can you explain more about the change?
    I never use id unless debugging. itemId should be a unique id to it's parent. As you can see by my example, I use the same itemId but since they have 2 different parents they are still unique.
    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.

  8. #8
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    0
    phamtieugiao is on a distinguished road

      0  

    Default


    Tested, if I put like this:
    Code:
            Ext.apply(this, {
                _itemId: this.name + 'Button'
            });
    . Notice the '_' character. Then the down() method works.

    Seems like Ext.apply doesn't change the _itemId if declared like this:
    Code:
            Ext.apply(this, {
                itemId: this.name + 'Button'
            });

  9. #9
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Where are you adding that code? You should never do that anymore. You should always use the setter (setItemId).
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.