Class

mendix/lib/MxContext

mendix/lib/MxContext()

An object that is passed to context aware widgets. An instance contains the GUID and entity relevant to the widget instance.

It also keeps track of which object is in its scope for a certain entity.

This class should never be instantiated manually.

Constructor

# new mendix/lib/MxContext()

Methods

# getTrackEntity() → {string}

Returns the current entity.

current entity

string
Example
context.getTrackEntity();   // "MyFirstProject.Pizza"

# getTrackId() → {string}

Returns the current GUID.

the current GUID

string
Example
context.getTrackId();   // "12345"

# getTrackObject() → {mendix/lib/MxObject}

Returns the current object.

the current object

Example
var obj = context.getTrackObject();
obj.getGuid();  // "12345"

# hasTrackEntity() → {boolean}

Checks whether this context has a current entity.

true if there is a current entity, false otherwise

boolean
Example
context.hasTrackEntity();   // true

# hasTrackId() → {boolean}

Checks whether this context has a current GUID.

true if there is a current GUID, false otherwise.

boolean
Example
context.hasTrackId();   // true

# hasTrackObject() → {mendix/lib/MxObject}

Checks whether this context has a current object.

true if there is a current object, false otherwise

Example
context.hasTrackObject();   // true

# setContext(entity, guid)

Sets current entity and GUID and maps GUID to entity in scope.

It clears the current object.

Parameters:
Name Type Description
entity string

entity to set

guid GUID

GUID to set

Example
context.setContext("MyFirstModule.Entity", "12345");

# setTrackObject(obj)

Sets the current object and sets it in scope for its entity.

Parameters:
Name Type Description
obj mendix/lib/MxObject

new current object

Example
context.setTrackObject(obj);