-
19 Apr 2012 12:59 AM #1
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.
The notificationCall is undefined and i cant figure it out how to pass that card to the showNotification function.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); }, });
-
19 Apr 2012 5:12 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
You need to call the get method that is created for the ref
Code:this.getNotificationCall()
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.
-
19 Apr 2012 5:52 AM #3
No error but nothing happen, and the console logs "undefined".Code:showNotification: function(){ console.log(this.getNotificationCall()); Ext.Viewport.animateActiveItem(this.getNotificationCall(), this.slideRightTransition); }
My Notification View:
ThxCode:Ext.define('BunkerGlam.view.Notification', { extend: 'Ext.Container', xtype: 'notificationview', config: { layout: 'card', items: [{ xtype: "toolbar", title: 'Notification', docked: "top", }] } });
-
19 Apr 2012 6:33 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
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
________________
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.
-
19 Apr 2012 9:52 AM #5
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?
-
19 Apr 2012 11:45 AM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
- Answers
- 3155
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
________________
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