Hybrid View

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Location
    New Delhi, INDIA
    Posts
    60
    Vote Rating
    1
    pnhegde is on a distinguished road

      0  

    Default How to add event handler for dynamically created widgets in the controller?

    How to add event handler for dynamically created widgets in the controller?


    Hello Forum members,

    I'm a newbie to ExtJs world. I started implementing a MVC based ExtJs 4 project. My problem is -
    I have a view(myview.js) which contains a button. Whenever I click on that button (mycontroller.js) I'll create a new window which pops up on the parent window. This new window contains a button and now I need to handle click event for this button. How can I do it? Where should I write the event handler? I tried to do it in mycontroller.js itself. But it's not working as the window is getting created in the runtime. Can someone help me regarding this please?

    Thanks a lot

  2. #2
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    536
    Vote Rating
    70
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      2  

    Default


    It shouldn't matter that the window gets created later. If the window has an itemId or alias you can target it pretty easily. In your this.control call in your controller you can use a selector like
    '#itemId button[text="Cancel"]'

    Of course if you changed your button text then it wouldn't work, so you might want to target it differently. I try not to go too crazy with itemIds, but they are preferable to ids when you need to use something like that.

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    3
    Vote Rating
    0
    david le is on a distinguished road

      0  

    Default hehe

    hehe


    thanks a lot, you have just resolved my problem...

Thread Participants: 2

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