-
8 Aug 2012 7:37 AM #11
No problem, what are you trying to do? My mentioned of not needing quotes was in reference to the instructions I had given:
-Put an id of "myButton" on the button (no quotes)
Sencha does put the quotes on there, but it works and only the ref will now trigger the action. Did you follow the instructions or download that sample I uploaded? Are you just trying to get a reference to a component or something more complicated than that?
-
8 Aug 2012 7:43 AM #12
I think I might have misunderstood something here.
Looking at your button.xda example. Is there anyway you could have used the myButton ref in the control object.
So rather then,
Something likeCode:Ext.define('MyApp.controller.MyController', { extend: 'Ext.app.Controller', config: { refs: { myButton: '#myButton' }, control: { "button": { tap: 'onButtonTap' } } },//other code omitted
Code:Ext.define('MyApp.controller.MyController', { extend: 'Ext.app.Controller', config: { refs: { myButton: '#myButton' }, control: { "myButton": { // use a ref here tap: 'onButtonTap' } } },
-
8 Aug 2012 7:57 AM #13
Yes, you can do exactly that - just select the "tap" action for the button and then in the Config panel set the ControlQuery to the id of the button (see attached screenshot). Also attached is a working example that shows myButton which will pop up a dialog when tapped, there's also a second button to show that it does not trigger the same action when tapped
Does that answer your question?
-
8 Aug 2012 9:10 AM #14
So I realize you can use a component query in the control section, what I meant was there a way to work through the ref exclusively.
So if you ref wasCould you do something likeCode:refs : { fooRef : "#mybutton" }I haven't been able to get it to work, but if it doesn't work I don't have a problem using component queries. I would have just been nice to have refs do everything just for the purpose of DRY design.Code:control { fooRef : { tap: somefunction }}
-
19 Sep 2012 2:51 PM #15
I'd love to know the answer to this as well. The framework allows unquoted property names to mean the ref name but it seems there is no provision in Architect to generate the config that way.
Perhaps the Controller Action section could have a property with a dropdown picker that lists all the defined refs?
-
19 Sep 2012 3:05 PM #16
-
19 Sep 2012 3:23 PM #17
Thank you. A little more searching the forums and a little more care with my ref selector next time.
My selector wouldn't find the component by itemId alone. It is a child of a container so I had to put the xtype of the container first. Is this right? e.g.
Code:config: { refs: { taskNavPanel: { autoCreate: true, selector: 'taskpanel', xtype: 'taskpanel' }, taskList: 'taskpanel #taskList' },
-
20 Sep 2012 12:48 PM #18
Yes, you can either prequalify it via a parent item and/or you could put its xtype#myItemId.
Aaron Conran
@aconran
Sencha Architect Development Team


Reply With Quote