Results 1 to 6 of 6

Thread: Controller refs help

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    You need to call the get method that is created for the ref

    Code:
    this.getNotificationCall()
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,412
    Answers
    3898
    Vote Rating
    1288
      0  

    Default

    without the autoCreate option I posted then the ref will only work if you have an instance somewhere.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •