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.
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);
}
});
}
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.