Results 1 to 2 of 2

Thread: firing events on controller from view

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2010
    Posts
    33
    Answers
    2
    Vote Rating
    0
      0  

    Default Answered: firing events on controller from view

    I am not sure how I can fire an event on the controller from my view. I want the event to be triggered from the view .. something like

    Code:
    listeners: {
    itemtap: function(dv, i, t, r, evt){ console.log('itemtap called'); //get the selected element var el = Ext.get(evt.target); //fire the selected event this.fireEvent('tapListingItem', r, el); } }
    on the controller side I want to capture this event but I dont want to create a hard reference to this list. I simply want the event to be fired on the controller without it knowing about who fired it Because the same controller is supposed to handle these events from multiple lists.

    Thanks
    Adeel

  2. This is up to your ComponentQuery in the control config in the controllers. If it is generic enough then it won't be bound to knowing the application structure.

    Code:
    control : {
        'dataview' : {
            tapListingItem : 'onTapListingItem'
        }
    }
    That is generic to listen to any tapListingItem event on any dataview (or subclass like List).

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    This is up to your ComponentQuery in the control config in the controllers. If it is generic enough then it won't be bound to knowing the application structure.

    Code:
    control : {
        'dataview' : {
            tapListingItem : 'onTapListingItem'
        }
    }
    That is generic to listen to any tapListingItem event on any dataview (or subclass like List).
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •