Mendix Client 5 API Documentation


mendix.lib.MxContext

mendix.lib.MxContext is an Object that is passed to ‘context aware’ widgets. An instance of MxContext contains the GUID identifier and entity string relevant to the widget instance.

Methods

hasTrackEntity()

Checks whether the context has a current entity.

Returns

Type Description
Boolean true when the context has a current entity, false otherwise.

Example

context.hasTrackEntity();   // true

hasTrackId()

Checks whether the context has a current GUID.

Returns

Type Description
Boolean true when the context has a current GUID, false otherwise.

Example

context.hasTrackId();   // true

hasTrackObject()

Checks whether the context has a current MxObject.

Returns

Type Description
Boolean true when the context has a current object, false otherwise.
context.hasTrackObject();   // true

getTrackEntity()

Returns the current entity of the context.

Returns

Type Description
String Current entity of the context.

Example

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

getTrackId()

Returns the current GUID of the context.

Returns

Type Description
String Current GUID of the context.

Example

context.getTrackId();   // "12345"

getTrackObject()

Returns the current MxObject.

Returns

Type Description
MxObject Current object of the context.

Example

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

setTrackEntity(entity)

Sets the current entity of the context.

Parameters

Name Type Description
entity String The new current entity of the context.

Example

context.setTrackEntity("MyFirstProject.Pizza");

setTrackId(guid)

Sets the current GUID of the context and resets the current MxObject.

Parameters

Name Type Description
guid String The new current GUID of the context.

Example

context.setTrackId(obj.getGuid());

setTrackObject(obj)

Sets the current MxObject of the context.

Parameters

Name Type Description
obj MxObject The new current GUID of the context.

Example

context.setTrackId(obj);