mmir.env.view.SimpleViewEngine
Example for a simplified view/rendering engine:
uses the standard document API for rendering / inserting views into the current document.
Example
mmir.present.render('theController', 'theView');
Methods
-
hideCurrentDialog()
-
Closes a modal window / dialog.
-
hideWaitDialog()
-
Hides / closes the "wait" dialog.
-
render(ctrlName, viewName, view, ctrl, data){Promise}
-
Actually renders the View.
Fetches the layout for the controller, then fills the layout-template with the view content, while incorporating partials and contents that helper methods have provided. Then Dialogs are created and the pageContainer id is updated. At last all the content is localized usingmmir.LanguageManager#translateHTML
, and appended to the HTML document of the application, while the old one is removed.
At the end the on_page_load action is performed.Name Type Description ctrlName
String Name of the controller viewName
String Name of the view to render view
Object View object that is to be rendered ctrl
Object Controller object of the view to render data
Object optional optional data for the view. Returns:
Type Description Promise a Promise that gets resolved when rendering is finished -
showDialog(ctrlName, _dialogId, _data){Object}
-
Opens the requested dialog.
Name Type Description ctrlName
String Name of the controller _dialogId
String Id of the dialog _data
Object Optionally data - not used Returns:
Type Description Object the instance of the current dialog that was opened -
showWaitDialog(text, theme)
-
Shows a "wait" dialog, i.e. "work in progress" notification.
Name Type Description text
String optional OPTIONAL the text that should be displayed. If omitted the language setting for loadingText
will be used instead (from dictionary.json)theme
String optional OPTIONAL set the jQuery Mobile theme to be used for the wait-dialog (e.g. "a" or "b"). NOTE: if this argument is used, then the text
must also be supplied.