Application Packaging Standard

Last updated 18-Mar-2019

init

The init method is called on loading a view and is used to initialize the widget properties. It is not called, when navigating to the view for the second and all subsequent times.

Normally, the method initiates widgets and returns widget definition without loading them.

Warning

This method should not contain async or long running operations.

Typical structure of the init method looks as in the following example:

var self = this;

/* Definition of data sources and variables, for example: */
var vpsStore = new Store({
   apsType: "http://aps-standard.org/samples/basic1p/vps/1.0",
   target: "/aps/2/resources/"
});

/* Definition of functions used for processing widgets and related events,
  such as onClick, renderCell, or onChange functions, for example: */
var add = function() {
   /* Start the process of creating a VPS by going to the first screen */
   aps.apsc.gotoView("server-new-1");
};
var refresh = function() {
   /* Refresh the Grid */
   self.byId("srv_grid").refresh();
};

/* Finally, create and return the widget hierarchy, for example: */
return ["aps/Grid", {
      id:                  self.genId("srv_grid"),
      store:               store,
      selectionMode:      "multiple",
      apsResourceViewId:   "server.edit",
      columns:             [
         { field: "name", name: "Name", type: "resourceName" },
         ...
      ]
    }, [
         ["aps/Toolbar", [
            ["aps/ToolbarButton", {
               id: this.genId("srv_new"),
               label: "New",
               onClick: add
            }],...
]]]];

UX1 loads the widgets and only after that calls the onShow method.

onShow