-
2 May 2012 12:35 PM #1
Unanswered: Query for an element in a template
Unanswered: Query for an element in a template
Hi peeps,
Does anyone know how to get an element in a tpl item from a controller, i.e. if I have in a Panel
And then in a controller I haveCode:config:{ tpl:['<div class="container">', '<div' id="button-div"></div>', '</div>' ] }
The controller doesn't find anything, I have also used this.myPanel().query('#button-div') to confirm this.Code:control:{ 'panel #button-div':{ tap:'handleTap' } }
Is this even possible or should I be doing it in a different way? Thanks for your time.
-
2 May 2012 1:22 PM #2Ext GWT Premium Member
- Join Date
- May 2010
- Location
- Ashburn, Virginia
- Posts
- 48
- Vote Rating
- 2
- Answers
- 8
In the control you could use the delegate option
Something like this should work for you although normally in the panel i would put it on the element which might mean you have to putCode:control:{ 'panel': { tap:'panelTap', delegate:'div#myButton' } }
Code:tap:'panelTap', element:element, delegate....
-
2 May 2012 2:16 PM #3
Hi,
I tried that but Im not sure its working, its still not triggering the events on the controller. Following sencha touch guidelines is this the correct way to handle events in the controller? or should I forget about it and put all the stuff in the view.
I should mention something else, Im using a navigation view, so the view that contains the button is not there since the beginning I push that view when the user clicks on an item on a list.
So the detail view that I push is the one that has the div that I want to listen.
-
3 May 2012 8:09 AM #4
Control refresh?
Control refresh?
I found another thing, and someone might confirm this,
I have my doubts about how the control stuff works, does that listen for events on all the views that are currently in the viewport?
If I add a view after some event, does the control stuff reapply to the new view on the viewport? or is there a function that I should call to refresh the references there, cause when I use this from a controller function:
It kind of works... this is an ugly solution cause I have to add the events every time Im adding a view. And when I pop the view I get an error on the bind function... going crazy with this thing...Code:this.getMyPanel().on({ tap:this.handleTap, scope:this, element:'element', delegate:'#voteDown' });


Reply With Quote