actionHandler
Use actionHandler to call Gosu on the server
side, get a result back, and then render the page again. For example, if you have a button in
your panel that navigates to another PCF page, then you would need to use an
actionHandler. The handler could call SomePage.go(),
and PolicyCenter would go through its usual cycle to rebuild and
render the widget tree. Note that the TemplatePanel may be removed from the
tree in the process. If you navigate to another PCF page, then the panel will definitely be
discarded. Even if you stay on the same PCF page, the panel may be rendered again, depending
on how much changed.
actionHandler must conform to the following
interface:public interface TemplatePanelActionHandler {
void action(gw.api.json.JsonObject json);
}- The ID of the template panel. The ID is provided by substituting in the value __helper.TemplatePanelId. The __helper variable is provided as part of the context to the template panel.
- A JSON object to send to the server.
gw.api.submitTemplateAction("<%=__helper.TemplatePanelId%>", {name: typeName});When this JavaScript is executed on the client side, it calls the server with the specified
template panel ID and JSON. The server looks up the Gosu actionHandler for
the template panel and executes it, passing the JSON as its argument. PolicyCenter then goes through its usual request life cycle, updating
and rendering all PCF widgets again.
See also
