Skip to main content


class %ZEN.Mojo.Component.mojoJsonProvider extends %ZEN.Auxiliary.jsonProvider

jsonProvider restricted to use the set of callbacks that Zen Mojo uses

Property Inventory


parameter NAMESPACE =;
Inherited description: This is the XML namespace used for library components.


property OnGetArray as %ZEN.Datatype.delegator (FORMALSPEC = "&pParameters:%String,*pMetaData,*pData", RETURNTYPE = "%Status", ZENENCRYPT = 0);
Inherited description: Supply data for the JSON provider as a server-side array.
This callback method is invoked when the page containing this jsonProvider is rendered.
This callback provides an easy way to ship a set of identical objects to the client by filling in a multidimensional array. The callback method is expected to fill in two structures:
pMetaData is a $List containing the names of the properties of the objects in the order in which they will appear.
pData is an array containing the data. Each node in the array should be a $List containing values for properties. This should match the meta data provided in pMetaData. The array of data can use any subscript value its wants. It is possible to define a hierarchical array. In this case, children nodes are placed within a parent collection called children.
If this callback is defined, then the OnGetTargetObject callback will not be invoked. For example:
Method GetArray(
	ByRef pParameters As %String,
	Output pMetaData,
	Output pData) As %Status
  Set pMetaData = $LB("name","rank","serialNo")
  Set pData(1) = $LB("Smith","Captain","444-33-2222")
  Set pData(1,1) = $LB("Jones","Corporal","333-22-3333")
  Quit $$$OK
This would result in the two objects being shipped to the client (in JSON format):
var content = {
	"name": "Smith",
	"rank": "Captain",
	"serialNo": "444-33-2222",
	"children": [
			"name": "Jones",
			"rank": "Corporal",
			"serialNo": "333-22-3333"
Property methods: OnGetArrayDisplayToLogical(), OnGetArrayGet(), OnGetArrayIsValid(), OnGetArrayLogicalToDisplay(), OnGetArrayLogicalToOdbc(), OnGetArrayNormalize(), OnGetArraySet()
property OnGetTargetObject as %ZEN.Datatype.delegator (FORMALSPEC = "&pParameters:%String,*pObject:%RegisteredObject", RETURNTYPE = "%Status", ZENENCRYPT = 0);
Inherited description: Supply data for the JSON provider as a set of server objects.
This callback method is invoked when the page containing this jsonProvider is rendered. It is expected to return (by reference) an instance of the object whose data is to be provided to the client in JSON format.
For example:
Method GetTarget(
	ByRef pParameters As %String,
	Output pObject As %RegisteredObject) As %Status
  Set pObject = ##class(MyApp.MyClass).%New()
  Set pObject.Name = "Bob"
  Quit $$$OK 
Property methods: OnGetTargetObjectDisplayToLogical(), OnGetTargetObjectGet(), OnGetTargetObjectIsValid(), OnGetTargetObjectLogicalToDisplay(), OnGetTargetObjectLogicalToOdbc(), OnGetTargetObjectNormalize(), OnGetTargetObjectSet()
property OnRenderJSON as %ZEN.Datatype.delegator (FORMALSPEC = "&pParameters:%String", RETURNTYPE = "%Status", ZENENCRYPT = 0);
Inherited description: Optional. If implemented this callback is expected to write out to the current device the contents of a set of related objects in JSON format.
If present, this overrides the default behavior of this component and the OnGetTargetObject callback is ignored.
Property methods: OnRenderJSONDisplayToLogical(), OnRenderJSONGet(), OnRenderJSONIsValid(), OnRenderJSONLogicalToDisplay(), OnRenderJSONLogicalToOdbc(), OnRenderJSONNormalize(), OnRenderJSONSet()
property OnSubmitContent as %ZEN.Datatype.delegator (FORMALSPEC = "pCommand:%String,pProvider:%ZEN.Auxiliary.jsonProvider,pSubmitObject:%RegisteredObject,&pResponseObject:%RegisteredObject", RETURNTYPE = "%Status", ZENENCRYPT = 0);
Inherited description: This callback method is invoked when the client submits an object to the server by calling the submitContent()() method. The callback is passed the submitted object in pSubmitObject after it has been converted from JSON format back into an object instance. It is also passed the command string supplied to the submitContent()() method in pCommand.
If the callback method returns an object via the pResponseObject argument, then this object is returned to the client and becomes the new content of the JSON provider.
For example:
Method SubmitHandler(
	pCommand As %String,
	pProvider As %ZEN.Auxiliary.jsonProvider,
	pSubmitObject As %RegisteredObject,
	Output pResponseObject As %RegisteredObject) As %Status
  Set tSC = $$$OK
  If ($IsObject(pObject)) {
    Set tSC = pObject.%Save()
  Quit tSC
Property methods: OnSubmitContentDisplayToLogical(), OnSubmitContentGet(), OnSubmitContentIsValid(), OnSubmitContentLogicalToDisplay(), OnSubmitContentLogicalToOdbc(), OnSubmitContentNormalize(), OnSubmitContentSet()

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab