Partial page updates
Run a component action and re-render only part of the page.
1. Include the script
Once per page, e.g. in your wrapper:
<wo:script namespace="ng" filename="ng-js.js" />
2. Mark what updates, and what triggers it
<wo:AjaxUpdateContainer id="clock">
<wo:str value="$now" />
</wo:AjaxUpdateContainer>
<wo:AjaxUpdateLink action="$refresh" updateContainerID="clock">Refresh</wo:AjaxUpdateLink>
public LocalTime now() {
return LocalTime.now();
}
public NGActionResults refresh() {
return null;
}
Elements
| Element | Tag | Key bindings |
|---|---|---|
AjaxUpdateContainer | auc | id (required), elementName (default div) |
AjaxUpdateLink | aul | action, updateContainerID (several: separate with ;) |
AjaxSubmitButton | asb | action, updateContainerID, value. Submits its form. |
AjaxObserveField | aof | observeFieldID, updateContainerID, action, fullSubmit, debounce (ms, default 300) |
Forms
<wo:form>
<wo:textfield value="$name" />
<wo:AjaxSubmitButton action="$greet" updateContainerID="greeting" value="Say hello" />
</wo:form>
<wo:AjaxUpdateContainer id="greeting">Hello <wo:str value="$name" /></wo:AjaxUpdateContainer>
Re-renders also run through the page cache, which keeps the latest render of each container.