|Manuals

Applying Properties to a Screen Rule

The apply Property

Once a host screen was identified, HostSurfer is ready to apply the associated rule definitions. This property is used with two meanings:

  • To declare user fields
  • To define the rendering template
  • To provide a handler that can take action upon rule selection
  • To provide complex actions defined for the recognized screen.
Property name Explanation
fields An array of objects that identifies each user-defined field mapped to the underlying host screen, implementing two-way data binding. Please refer to 'fields’ Property for details.
render It defines the HTML view for the underlying screen. This property supports two different sets of values, which is determined by the framework used to render the view. Please refer to render property for details.
handler A function that gets executed when the rule is selected. Please refer to handler property for details.
actions A list of actions that can be used from the resulting web page. Please refer to 'actions’ property for details.

The following code snippet is a simple example of apply property declaration:

apply: {
  fields: [
  { name: 'screenTitle', row : 1, col : 35, len : 30},
  { name: 'option', row : 18, col : 63, len : 2 }
  ],
  render: {
    view:  {
      template: '<h3>{{hs.data.shopsUpdatedUntil}} {{hs.data.shopsLastUpdate}}</h3>';
    }
  },
  handler: function (hs) {
    alert('Accounts last update: '+hs.data.accountsLastUpdate);
  },
  actions : {
    main: function(hs) {
      hs.data.option = "01";
      hs.send.enter();
    },
    logout: function(hs) {
      hs.send.pf1();
    }
  }
}

Additionally, in the context of a z/Scope Anywhere environment:

Property name Explanation
apps An Javascript object array that declare one or more HostSurfer applications or web-widgets. Please refer to 'applications’ for details.