1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    14
    Vote Rating
    1
    alexandrn is on a distinguished road

      0  

    Default Firing Custom Events from UI components

    Firing Custom Events from UI components


    Can anyone give a final and complete description if it is possible in Sencha Architect 2 to make a button fire a custom event "myevent" and controller listening for and correctly getting it.

    So far I could not find a place where in the Button config to put addEvents("myevent") so it will be correctly bubbled up.

    the line 13850: in the ext-all-debug.js is where the fireEvent("myevent") dies.


    continueFireEvent: function(eventName, args, bubbles) {
    var target = this,
    queue, event,
    ret = true;


    do {
    if (target.eventsSuspended === true) {
    if ((queue = target.eventQueue)) {
    queue.push([eventName, args, bubbles]);
    }
    return ret;
    } else {
    13850: event = target.events[eventName];



    if (event && event != true) {
    if ((ret = event.fire.apply(event, args)) === false) {
    break;
    }
    }

    }
    } while (bubbles && (target = target.getBubbleParent()));
    return ret;

    },

  2. #2
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,265
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Find attached a simple project which fires a custom event.

    Hope this helps.

    Regards.

    event.xda

    Edit:
    Updated project which fires custom event from custom button's click.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  3. #3
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,265
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Quote Originally Posted by ssamayoa View Post
    Find attached a simple project which fires a custom event.
    BTW, if you find my answer useful please rate it!
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    14
    Vote Rating
    1
    alexandrn is on a distinguished road

      0  

    Default


    I would like to thank you very much.

    This is one definitive and straightforward example that answers so many questions at once.

    Basically one needs to "Promote To Class" UI object (say button) and then he will be able to drag and drop "Custom Event" from toolbox or from config window add it through + on newly appeared category Custom Events.

    Without Promoting to Class custom events won't be able to work with in Sencha Architect.

    Thank you. +100

  5. #5
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,265
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      1  

    Default


    Quote Originally Posted by alexandrn View Post
    Without Promoting to Class custom events won't be able to work with in Sencha Architect.
    Not entirely correct.

    The target of the event must be a "top" view but the event can be fired by any other component as first button does.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    14
    Vote Rating
    1
    alexandrn is on a distinguished road

      0  

    Default


    Thank you.
    Would it possible to use bubbleEvents array on "promoted" button class to send custom event to the top window and attach controller to only the window, without doint the chain

    var win = button.up("window");
    win.fireEvent("myevent", win);

  7. #7
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,265
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Quote Originally Posted by alexandrn View Post
    Would it possible to use bubbleEvents array on "promoted" button class to send custom event to the top window and attach controller to only the window, without doint the chain
    I see no point on doing that.

    May be if you explain with a use case.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  8. #8
    Sencha Premium Member
    Join Date
    Nov 2007
    Posts
    79
    Vote Rating
    4
    oldroy is on a distinguished road

      0  

    Default fireEvent

    fireEvent


    Hello,
    Have you tried listening for the button event on the view and then using fireEvent to fire and event that the controller can listen to?

    I don't know your case, but in MVC I'm not sure how often you need to do that.

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