createView

Creates a View of the component instance with the specified name and layout.

uniface.Instance.createView(ViewName, ViewLayout, parentElement )

Arguments

  • ViewName—a name for the View that is unique within the context of the current server page.
  • ViewLayout—a URL to an HTML layout of the View, or a literal string containing the HTML of the view layout.
  • ParentElement—makes the view visible in the specified parent element.

Return Value

Returns a JavaScript Promise object. If the View is created, the promise is resolved with an instance of uniface.View corresponding to the newly created View.

If creation fails, the promise is rejected with either:

  • An instance of uniface.DuplicateViewNameException if a View with the specified name already exists.
  • An instance of uniface.Error describing the cause.

For more information, see Promises .

Creating and Addressing Views

// creating a view
myInstance.createView("myView", "../myapp/view1.html", document.getElementById('mydiv')).then(function (view) {
  // view is created and ready
});

// getting a view 
var view = myInstance.getView("myview");  

// showing a view
myInstance.getView("myview").show("body").then(function () {
  // view is now shown and realized
});

Related Topics