IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Does an Async Action trigger an Event?

    Posted Fri July 13, 2012 06:01 PM

    Is there a generic event (not specific to any one control, but maybe to the whole document or the form) that occurs when an client side async action occurs? I’d like to be able to refresh a control (a messages panel) every time any button is pressed without having to manually set the refresh on every button.

    In effect, I’d like to mimic how the CAF Message controls work.

    Any thoughts are appreciated!

    Lucas.


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 2.  RE: Does an Async Action trigger an Event?

    Posted Mon July 16, 2012 08:15 PM

    You should be able to listen for the CAF actionCompleteListener events using the OpenAjax hub (http://www.openajax.org/member/wiki/OpenAjax_Hub_1.0_Specification_PublishSubscribe).

    For example, something like this in a Script Block control:

    
    if (window.mysub == null) {
    //subscribe for action completion events
    window.mysub = OpenAjax.hub.subscribe("CAF.Command.actionCompleteListener.*", function(event, actionid) {
    //filter events to make sure it is originating from a form in the current portlet.
    
    if (actionid != null && actionid.startsWith("#{caf:cid('defaultForm')}") {
    alert("notified about action event inside the portlet form for: " + actionid);
    }
    });
    }

    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 3.  RE: Does an Async Action trigger an Event?

    Posted Mon July 16, 2012 08:20 PM

    if you want to see what events are firing, you could subscribe to them all and log it somewhere for inspection:

    For example, if you are using firefox with firebug, then this javascript would log all the events to the firebug console:

    OpenAjax.hub.subscribe("**", function(topic, data) {console.log(topic);});

    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 4.  RE: Does an Async Action trigger an Event?

    Posted Tue July 17, 2012 11:41 AM

    Good stuff, Eric. Thanks once again.

    My issue now (and this may be insurmountable) is that in my function I want to refresh a control, but I think since it is firing on actionComplete (and not refreshComplete) I’m getting an “…out of sync with server message”.

    I’m just now sure how I can do this generically with out some coordination between the base portlet and the included portlet where this script would exist.

    Thanks a million.


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine