Class: View

View

new mmir.view.View(ctrl, name, definition)

The View class is a kind of interface-class which gives access to the methods and data of a helper (which itself belongs to a controller)
Apart from initializing some properties, the constructor also parses the view description and looks for needed helper methods.
Name Type Description
ctrl Object Controller instance / object
name String Name of the View
definition String View description, i.e. the raw template code that will be processed. May be empty: in this case the processed contents must be added manually (cf. parser.StorageUtils)

Requires

  • module:if
  • module:if

Members

An array of all the views mmir.view.ContentElement objects.
The controller to which this view belongs.

defString

The description of the view in eHTML.

helperMethodsArray

An array of all names of the for the view required helper methods.
Deprecated
  • helper methods must now explicitly called in template definition (using syntax @helper(name,args))

    nameString

    The name of the view.

    Methods

    getContentElement(name){object}

    Gets a specific mmir.view.ContentElement object by name.
    Name Type Description
    name String Name of the ContentElement object
    Returns:
    Type Description
    object The wanted ContentElement object or null

    getController(){Object}

    Gets the name of a view.
    Returns:
    Type Description
    Object The controller for the view

    getDefinition(){String}

    Gets the definition of a view.
    Returns:
    Type Description
    String The view description string

    getHelperMethods(){Array}

    Gets an array of all helper methods.
    Returns:
    Type Description
    Array Array of all helper methods
    Gets the name of a view.
    Returns:
    Type Description
    String The name of the view

    stringify(disableStrictMode){String}

    Name Type Description
    disableStrictMode Boolean optional OPTIONAL disable JavaScript strict mode in the generated view code
    Returns:
    Type Description
    String the stringified representation for the View