Using ajax in widgets

When using dynaWidgets you do not want to reload the whole page on every request, especially on updating the widget´s contents. The following practices shows how to use ajax in combination with dynaWidgets.

Ajax Status Indicator

Whenever ajax is processed from within a widget the ajax status indicator in the widget header will be shown until the action is finished:

Ajax Loading of widget content

The initial loading of the widget contents can be proceeded in parallel by using ajax. Therefore the dynaWidget grid must be configured like this:
			<dwComp:dynaWidgetGrid id="myGrid" columns="2" 
				...
				loadWidgetsByAjax="true"
			... />
      	
What´s important here:

Processing ajax actions from within a widget

For using ajax in widget contents there are special ajax action components:
      		ajaxWidget_view.xhtml:
      		...
			<dwComp:widgetAjaxLink 
				value="do some ajax action" 
				reRenderWidget="true" 
				actionBean="#{myWidgetActionBean}"
				actionName="myAction" />
			... 				
      	
What´s important here:

An example for using ajax in a widget

Ajax action widget
This widget will perform an ajax action to update it´s content. Just press on the link bellow!

do some ajax action


For details on using the ajax action components see content components.