Class: View

View

new 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

contentForsArray.<ContentElement>

An array of all the views mmir.ContentElement objects.

controllerController

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

    executeHelperMethods(data)

    Executes all helper methods that were specified / referenced in the view; with **data** as parameter.
    Name Type Description
    data Object Parameter to pass to the helper methods
    Deprecated
    • helper methods must now explicitly called in template definition (using syntax @helper(name,args))

      getContentElement(name){object}

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

      getController(){Object}

      Gets the name of a view.
      Returns:
      controller for the view

      getDefinition(){String}

      Gets the definition of a view.
      Returns:
      view description string

      getHelperMethods(){Array}

      Gets an array of all helper methods.
      Deprecated
      • helper methods must now explicitly called in template definition (using syntax @helper(name,args))
        Returns:
        of all helper methods

        getHelperMethods(){Array}

        Gets an array of all helper methods.
        Returns:
        of all helper methods
        Gets the name of a view.
        Returns:
        name of the view