1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
    levyke is on a distinguished road

      0  

    Default Unanswered: Controller refs help

    Unanswered: Controller refs help


    Hi,

    I`m trying to show a card on button tap. Everything working fine just i cant call the desired card.

    Code:
    Ext.define('TestApp.controller.Home', {
        extend: 'Ext.app.Controller',
    
        config: {
            refs: {
                notificationButton: 'button[action=showNotification]',
                notificationCall: 'notificationview'
            },
            control: {
                notificationButton: {
                    tap: 'showNotification'
                }
            }
        },
        
        slideRightTransition: { type: 'slide', direction: 'right' },
        
        showNotification: function(){
            console.log('working');
            Ext.Viewport.animateActiveItem(notificationCall, this.slideRightTransition);
        },
     });
    The notificationCall is undefined and i cant figure it out how to pass that card to the showNotification function.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,649
    Vote Rating
    898
    Answers
    3575
    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 need to call the get method that is created for the ref

    Code:
    this.getNotificationCall()
    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
    Apr 2012
    Posts
    2
    Vote Rating
    0
    levyke is on a distinguished road

      0  

    Default


    Code:
    showNotification: function(){
            console.log(this.getNotificationCall());
            Ext.Viewport.animateActiveItem(this.getNotificationCall(), this.slideRightTransition);
        }
    No error but nothing happen, and the console logs "undefined".

    My Notification View:
    Code:
    Ext.define('BunkerGlam.view.Notification', {
        extend: 'Ext.Container',
        xtype: 'notificationview',
        
        config: {
            layout: 'card',
            items: [{
                xtype: "toolbar",
                    title: 'Notification',
                    docked: "top",
            }]
        }
    });
    Thx

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


    That means that there is no component that is created with xtype of notificationview. If you need to create it you can do this:

    Code:
    refs : {
        notificationCall : {
            selector : 'notificationview',
            xtype : 'notificationview',
            autoCreate : true
        }
    }
    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
    Apr 2012
    Posts
    1
    Vote Rating
    0
    smimp is on a distinguished road

      0  

    Default


    I was looking at some of the samples and wasn't able to find where some of the refs were being created.

    Would a ref of #notificationcallCard auto create a card? Is that a shortcut or was I just missing the creation (in the sample, which uses a different name) and the card is actually created elsewhere?

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


    without the autoCreate option I posted then the ref will only work if you have an instance somewhere.
    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

Tags for this Thread