widget:handler

Purpose

Associates an event with an action; that is when a widget sends the event, the associated action is invoked.

Contained by

Attribute groups

Attributes

Attribute Description Type Default Options Use
action Specifies an action that will be invoked when the defined event occurs xs:string   enable, disable, invoke, show, hide, clear-content, show-content, hide-content, press, dismiss, next-month, next-year, previous-month, previous-year, set-today, first-page, last-page, next-page, previous-page, next-row, previous-row, force-sync, clear-value, execute, reset, split, start, stop, launch  required 
event Specifies an event on which an action should be invoked xs:string   pressed, completed, page-changed, failed, succeeded, dismissed, finished, value-changed  required 
is-enabled Specifies if the selected handler is enabled. A disabled handler does not invoke an action when an event arrives. xs:boolean     optional 

Property

Property Description Type Access
is-enabled Specifies whether or not the handler is enabled. A disabled handler does not invoke an action when an event arrives. xs:boolean read/write 

Example

<?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:handler</title>
    <widget:handler event="query#partial-value#value-changed" action="load-script#invoke"/>
    <widget:script id="load-script">
      $W('tbody').getLoad().setSrc('http://localhost:8080/mcs/projects/client-app/service/table?mcs-query='+$W('query').getPartialValue())
      $W('tbody').getLoad().execute() </widget:script>
  </head>
  <body>
    <p>Country<widget:input id="query"/></p>
    <widget:table>
      <thead>
        <tr>
          <th>Code</th>
          <th>Country name</th>
        </tr>
      </thead>
      <widget:tbody id="tbody" style="color: #fff;">
        <widget:load src="http://localhost:8080/mcs/projects/client-app/service/table" when="onload"/>
        <tr style="background-color:#fff">
          <td>--</td>
          <td>Loading, please wait...</td>
        </tr>
      </widget:tbody>
    </widget:table>
  </body>
</html>

Related topics