widget:refresh

Purpose

Allows a widget to update its contents.

Contained by

Attribute groups

Attributes

Attribute Description Type Default Options Use
interval The minimum interval between content refreshes in seconds. Initially the timer starts from the moment the widget is created; subsequently it starts after the widget's content has been updated. xs:intiger     required 
src The URL from which the update can be retrieved, relative to the containing page xs:anyURI     required 

Action

Action Description
execute Executes AJAX request

Property

Property Description Type Access
src The URL from which the data can be retrieved xs:anyURl read/write 

Events

Event Description
failed The event is sent when an AJAX request fails
succeeded The event is sent when an AJAX request succeeds

Example

A Ticker Tape widget that updates its contents dynamically every 15 seconds.

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:widget="http://www.volantis.com/xmlns/2006/05/widget">
  <head>
    <title>widget:refresh</title>
  </head>
  <body>
    <widget:ticker-tape id="myWeatherTicker">
      <widget:refresh
        src="http://localhost:8080/mcs/projects/client-app/service/ticker?id=myWeatherTicker"
        interval="15"/>
      <span>Ticker Tape can be configured to periodically refresh its content by fetching data, such
        as weather conditions, from a web service...</span>
    </widget:ticker-tape>
  </body>
</html>

Related topics