1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default Answered: Newbie questions

    Answered: Newbie questions


    Hello,
    Ext JS is something new for me. I hope someone answer my questions.
    1. What is the different between this.control and this.application.on within ths init:function inside a controller file?
    2. If I have different panels with buttons inside a viewport, how do you catch the events for the different button-pushes from the views inside the controller?
    3. If I have three different fields within same panel, how can I use the same change-listener for all the three fields?
    Thanks in advance

  2. 1.
    this.application.on:
    listen to events fired by your application, it's mostly used for firing an event in a controller:

    Code:
    this.application.fireEvent('blaaa');
    and listen to it on another controller, this will be replaced in ExtJs 4.2 there you can use this.control for it =)

    this.control: can listen to nearly everything with the help of a selector

    2.
    The common way is to give the buttons an action:

    Code:
    //... Button config... bla
    action: 'user-create';
    then listen to it in the controller:

    Code:
     this.control({
                'button[action=user-create]': {
                    click: this.createUserAction
                }
    });
    3.
    Just call the same function o.O

    Code:
    
    
    Code:
     this.control({
                'textfield[itemId=user-email]': {
                    change: this.changeWhatever
                },
                'textfield[itemId=user-name]': {                change: this.changeWhatever
                },
                'textfield[itemId=user-passwd]': {
                    change: this.changeWhatever
                },
    });



  3. #2
    Sencha User Arg0n's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    122
    Answers
    12
    Vote Rating
    16
    Arg0n will become famous soon enough Arg0n will become famous soon enough

      1  

    Default


    1.
    this.application.on:
    listen to events fired by your application, it's mostly used for firing an event in a controller:

    Code:
    this.application.fireEvent('blaaa');
    and listen to it on another controller, this will be replaced in ExtJs 4.2 there you can use this.control for it =)

    this.control: can listen to nearly everything with the help of a selector

    2.
    The common way is to give the buttons an action:

    Code:
    //... Button config... bla
    action: 'user-create';
    then listen to it in the controller:

    Code:
     this.control({
                'button[action=user-create]': {
                    click: this.createUserAction
                }
    });
    3.
    Just call the same function o.O

    Code:
    
    
    Code:
     this.control({
                'textfield[itemId=user-email]': {
                    change: this.changeWhatever
                },
                'textfield[itemId=user-name]': {                change: this.changeWhatever
                },
                'textfield[itemId=user-passwd]': {
                    change: this.changeWhatever
                },
    });



  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default


    Thank you for your reply.

    Should the listeners be programmed inside the views or be moved to the controllers if you follow the recommended MVC-architecture?

  5. #4
    Sencha User Arg0n's Avatar
    Join Date
    Apr 2012
    Location
    Germany
    Posts
    122
    Answers
    12
    Vote Rating
    16
    Arg0n will become famous soon enough Arg0n will become famous soon enough

      1  

    Default


    Listeners should be moved to the controllers if you want to use the MVC structure.

    One big disadvantage is, that you cant listen to store events in controllers... You can, but it's tricky ^^
    This will be changed with ExtJs 4.2 too =)

  6. #5
    Sencha User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    13
    Vote Rating
    0
    Intraday is on a distinguished road

      0  

    Default


    Great,

    The last question?
    Is it any difference to set up listeners for the view components in the controllers by using, itemId, name or action?

Thread Participants: 1

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