Develop > Presentation layer > WebSphere Commerce foundation tag library


Tag: declareRefreshController

The declareRefreshController tag declares a refresh area controller. The refresh area controller provides the JavaScript logic that listens to changes in the render context and the model. It refreshes the refresh areas registered to the controller. Refresh areas are declared using the wc.widget.RefreshArea widget and by specifying the ID of a declared refresh controller for the controllerId attribute.

Tag Information
Tag File /META-INF/tags/wcf/DeclareRefreshController.tag
Body Content empty
Display Name Declare refresh controller

Attributes
Name Required Type Description
id true String Refresh controller ID.
renderContextId false String The render context ID. If the render context ID is not specified, then default is assumed.
url false String The URL that will be invoked to retrieve the refresh data.
modelChangedScript false JSP fragment JavaScript that is to be run when a model change occurs. The script may make use of several local variables:

  • controller - the refresh controller

  • message - the model changed event message

  • widget - the refresh area widget

  • renderContext - the render context

renderContextChangedScript false JSP fragment JavaScript that is run when a render context change occurs. The script may make use of several local variables:

  • controller - the refresh controller

  • message - the model changed event message

  • widget - the refresh area widget

  • renderContext - the render context

json false String This attribute must be set to true if the expected response type from the refresh URL is JSON. The default is HTML.
refreshScript false JSP fragment JavaScript that is run to perform the refresh. The script may make use of the following local variables:

  • controller - the refresh controller

  • widget - the refresh area widget

  • data - the refresh request response data

  • renderContext - the render context.

If this attribute is not specified, then the default behavior is to call widget.setInnerHtml(data).

postRefreshScript false JSP fragment JavaScript that is run after the refresh has completed. The script may make use of several local variables:

  • controller - the refresh controller

  • widget - the refresh area widget

  • renderContext - the render context


Example

The following example declares a refresh controller object that will update a refresh area with the current order information.

<wcf:declareRefreshController  
id="currentOrderTotalsAreaController" 
                               
url="${AjaxCurrentOrderInformationViewURL}" 
                               
renderContextId="currentOrderTotals_Context"
                                >        
<jsp:attribute name="modelChangedScript">                 if (message.actionId in order_updated) {
                        widget.refresh();                 } 
 
</jsp:attribute>
</wcf:declareRefreshController>

Related reference

WebSphere Commerce foundation tag library


+

Search Tips   |   Advanced Search