1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    7
    Vote Rating
    1
    aldoreyes is on a distinguished road

      0  

    Default 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

    Code:
    config:{
       tpl:['<div class="container">',
                '<div' id="button-div"></div>',
        '</div>'
    ]
    }
    And then in a controller I have

    Code:
    control:{
        'panel #button-div':{
          tap:'handleTap'
       }
    }
    The controller doesn't find anything, I have also used this.myPanel().query('#button-div') to confirm this.

    Is this even possible or should I be doing it in a different way? Thanks for your time.

  2. #2
    Ext GWT Premium Member
    Join Date
    May 2010
    Location
    Ashburn, Virginia
    Posts
    48
    Answers
    8
    Vote Rating
    2
    darren102 is on a distinguished road

      0  

    Default


    In the control you could use the delegate option

    Code:
    control:{
        'panel': {
            tap:'panelTap',
            delegate:'div#myButton'
        }
    }
    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 put

    Code:
       tap:'panelTap',
       element:element,
       delegate....

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    7
    Vote Rating
    1
    aldoreyes is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha User
    Join Date
    May 2012
    Posts
    7
    Vote Rating
    1
    aldoreyes is on a distinguished road

      0  

    Default 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:

    Code:
    this.getMyPanel().on({
                tap:this.handleTap,
                scope:this,
                element:'element',
                delegate:'#voteDown'
            });
    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...

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi