1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    5
    Vote Rating
    0
    Seraith is on a distinguished road

      0  

    Default Answered: MVC: Correct listening to dockedItem events?

    Answered: MVC: Correct listening to dockedItem events?


    Hello,
    I've set up a new application with the MVC pattern and want to listen to the events of the dockedItems of window A, but in don't know how to resolve the correct references to the item in the controller.

    ok here's a little example to clear things up

    The view
    Code:
    Ext.define('App.view.WindowA', {
        extend : 'Ext.tree.Panel',
        alias : 'widget.windowa',
    ....
        initComponent : function() {
            this.dockedItems = [{
                dock : 'top',
                xtype : 'toolbar',
                items : [{
                    xtype : 'button',
                    text : 'do something',
                }]
            }];
            this.callParent();
        }
    });
    the controller
    Code:
    Ext.define('App.controller.WindowA', {
        extend : 'Ext.app.Controller',
    
        refs : [{
            ref : 'windowA',
            selector : 'windowa
        }],
        init : function() {
            // Start listening for events on views
            this.control({
               'windowa' : {
                    select: this.doAnotherThing
                 },
                'windowa dockedItem' : {
                    click : this.doSomething
                }
            })
        },
        doSomething : function() {
            console.log("button pressed");
        },
       doAnotherSomething : function() {
            console.log("something selected");
        }
       
    });
    The problem now is when i press the button there's no output on the console and it seems that the event isn't handled by the controller. On the other hand the listening to the selection event of the windowA works fine and the console writes it's message.
    How do i listen to the events of the dockedItems?

    greetings seraith

  2. I think you'd just need to construct a suitable component query. Docked items are similar to normal items in that regard. e.g.

    Code:
    'windowa toolbar button'
    This has obvious issues if you have multiple buttons in toolbars but it should be fine in the example you gave. If you did have multiple buttons you'd need to come up with something a little different, see the component query docs for pointers.

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,575
    Answers
    540
    Vote Rating
    311
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I think you'd just need to construct a suitable component query. Docked items are similar to normal items in that regard. e.g.

    Code:
    'windowa toolbar button'
    This has obvious issues if you have multiple buttons in toolbars but it should be fine in the example you gave. If you did have multiple buttons you'd need to come up with something a little different, see the component query docs for pointers.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Germany
    Posts
    5
    Vote Rating
    0
    Seraith is on a distinguished road

      0  

    Default


    hey,
    thanks, just got the component query wrong like you said.
    greetings

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