Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

ZMbasics.Tutorial3.Template

class ZMbasics.Tutorial3.Template extends %ZEN.Mojo.Component.contentTemplate

This is the template for the ZM page ZMbasics.Tutorial3.HomePage.

The primary difference from Tutorial 2 is that *this* tutorial demonstrates the onselect() event handler.

Next tutorial in the series: ZMbasics.Tutorial4.HomePage.

Method Inventory

Parameters

parameter DOMAIN = Zen Mojo Demo;
Localization domain; best practice is to always specify this
parameter NAMESPACE = http://www.intersystems.com/zen/mojo/ZMTutorial3;
Each template class must have a unique combination of short class name and NAMESPACE parameter.

Methods

classmethod %OnGetJSONContent(pProviderName As %String, pKey As %String, ByRef pParms, Output pObject As %RegisteredObject, pCriteria As %RegisteredObject, pLoad As %Boolean = 0) as %Status
Implementation of callback method. This method provides content for the ZM page that uses this template. Arguments:
  • pProviderName is the name of the provider, as declared in the PROVIDERLIST parameter of the page.
  • pKey is an application-defined key that is used to indicate which content is to be served. Not used in this implementation.
  • pCriteria is an object containing search criteria. Not used in this implementation.
  • pParms is an array of additional parameters from the JSON provider (not currently used).
  • pObject is the object that will be served to the client in JSON format.
  • pLoad is true if this is called when the page is first being served. In this case, this method will be called even though there may a client-side method used to load the content.
clientmethod myGetMainViewLayout(key, criteria) [ Language = javascript ]
Method used to get layout information for the mainView component.

This method must create and return a JS object with layout information. Specifically, the JS object has a set of children, each of which corresponds to a block on the page. To create this JS object, it is necessary to know only the following:

  • Syntax to create a JS object.
  • The available ZM building blocks to use as children.
  • The properties that you can set for these building blocks.
  • The syntax for referring to the available data. The ongetdata callback, ultimately, creates a JSON string that includes a set of name/value pairs with values obtained from the server. When this JSON string arrives on the client, the name/value pairs are available to the client. Then, in this method, you can use the syntax =[name] to access a value. For example, =[dateOfBirth] accesses the dateOfBirth value.

ZM passes two values to this kind of callback in a <mojo:documentView>: key and criteria. Following best practices, this method uses these values as arguments so that they are available if needed. In this scenario, these values are not needed, and the method does not use them.

clientmethod onGetContent(providerName, key, criteria) [ Language = javascript ]
Implementation of callback. This client-side method is called by the page method getContent(). If providerName is the name of a layout object, this method invokes myGetMainViewLayout() and returns the result. Otherwise, this method returns null, which means that ZM calls the %OnGetJSONContent() of this template (thus going to the server instead).
clientmethod onselect(key, value, docViewId) [ Language = javascript ]
Notification that a select event has happened

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab