Developer

Automatic and Explicit Context Updates

Automatic and explicit context updates are both supported context management methods.

  • Automatic updates use data that is passed from another tile when a navigation action occurs. You can pass BO attributes, references to context or global context data, or to free text. Use $_context.<attribute> to refer to an existing local context attribute, and $_global.<attribute> for a global context attribute. This example shows how context parameters are passed when the navigate action is triggered. The target tile’s (TileB) local context is updated with the two values: a free text and a value coming from a binding:
    <UIElement type="button">
      <P pid="text" value="Go" />
      <P pid="halign" value="center" />
      <Event eventId="onClick">
        <Action actionId="navigate">
         <!--Context receiver – the target tile which receives the context upon navigating to it -->
          <P pid="target" value="TileB" />     
         <!-- Keys and values to be passed to the target Tile's local context -->
    	 <!-- The freetext value "Tablet" is passed for the key "type" -->
          <P pid="type" value="Tablet" />
    	 <!-- The movie title coming from the binding MovieTitles is passed for the key "movie" -->
    	  <P pid="movie" value="{$MovieTitles.Name}"	  
        </Action>
      </Event>
    </UIElement>
  • Explicit updates use the updateContext action. Use updateContext to update the local context of tiles that appear on the same screen, where navigation is impossible. iPad apps generally update a tile's local context explicitly.
    You must specify the target tile (the receiver) in the same way as for automatic updates. Similarly, define the key-value pairs to be passed to the target tile as properties. You can pass BO attributes, references to local or global context data, or to free text. Use $_context.<attribute> to refer to an existing local context attribute, and $_global.<attribute> for a global context attribute. To pass the same objects to several different tiles, add a new updateContext action for every tile and repeat the context parameters. This example demonstrates how to bind the updateContext to the onClick event of a button. When the device user taps the button, the Tile3 target tiles’s context is updated for the “platform” and “type” keys.
    <UIElement type="button">
      <P pid="text" value="Tablet" />
      <P pid="halign" value="center" />
      <Event eventId="onClick">
        <Action actionId="updateContext">
         <!—Context receiver – the target tile which receives the context-->
          <P pid="target" value="Tile3" />
         <!—the key and value to be updated -->
         <!-- $_context.<attribute> denotes a context attribute -->
          <P pid="platform" value="{$_context.platform}" />
         <!—the key and value to be updated – value is free text in this case-->
          <P pid="type" value="Tablet" />
        </Action>
      </Event>
    </UIElement>