A simple widget that displays templated output (or simple HTML/Text), parts of which may be data-bound.
Use a template only when using the ``load`` method or declarative syntax. You cannot use a template with programmatic declaration.
Table of contents
All user panels - CP and UX1
With the Output
widget you can display on the screen text, HTML or
data from a model while keeping the entire functionality intrinsic for widgets.
Regardless of the fact that the widget is able outputting arbitrary HTML,
you should output a maximally simple code. To define complex constructs,
it is better to use the Container
widget or declarative syntax.
Find the nested rules for this widget in the recommended Widget Hierarchy.
Widget’s content may be specified through the value
property
or through the content
property. When you configure a certain output,
the value
property should be used. If you need to define a template
that will contain additional properties, then you should use
the content
property.
Note
HTML code is not escaped in the content
field, but it is
escaped in the other properties. Refer to Probable Threats related with it.
You can mark up the text in the widget by assigning one of the following values to the alertType
property:
success
info
warning
danger
In a case you need to print out an HTML code in a container widget, use the Output
widget inside the widget.
For example, in a FieldSet
widget:
require(["aps/load", "aps/ready!"],
function(load){
"use strict";
load(["aps/PageContainer", [
["aps/Panel", [
["aps/FieldSet", { showLabels: false },
[[ "aps/Output", {
label: "OS",
value: "CentOS 6 (x86_64)"
}],
[ "aps/Output", {
label: "Source Image",
content: "<a href='https://www.centos.org/images/logo_small.png'>View CentOS icon</a>"
}]]
]
]]
]]);
});
You can link Output
with a Model
component using the
at
module (for details see Model ). To insert
data into the text being output, use the standard template syntax.
To refer to a widget’s property, enter the property name using the ${property_name} syntax.
require(["dojox/mvc/getStateful", "aps/load", "dojox/mvc/at", "aps/ready!"],
function(getStateful, load, at) {
"use strict";
var model = getStateful({ "num": 0 });
load(["aps/PageContainer", [
["aps/Panel", [
[ "aps/Output", {
content: "This is ${num}",
num: at(model, 'num')
}]]]]]);
setInterval(function(){ model.set("num", model.num+1); }, 1000);
});
PROPERTY | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
alertType | string | default | Type of visual format. |
content | string | ${value} | Pattern of the widget contents. |
disabled | boolean | false | Specifies if the widget will respond to user input. |
gridSize | string | undefined | This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. |
isBusy | boolean | false | If the widget is busy then this property is true. |
label | string | “” | Text that is shown as a label if the widget is placed inside a aps/FieldSet. |
value | string | “” | Widget contents. |
visible | boolean | true | If this property value is set to true, then the widget is visible. |
Type of visual format. Only for CCP v2. Possible values: “info”, “warning”, “danger”, “default”. Default value: “default”.
Pattern of the widget contents. Default value: “${value}”.
This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. In other cases it will be ignored.
gridSize string contains few options with number values (from 1 to 12) separated by spaces, which specify the grid size of the widget in different layouts:
- md - desktop
- xs - phone
For example, gridSize: “md-4 xs-2”.
All values below 1, e.g. “md-0”, will be replaced with the empty string (“”), values above 12, e.g. “md-14”, will be reduced to 12 (“md-12”).
Default value: undefined.
Text that is shown as a label if the widget is placed inside a aps/FieldSet.
Default value: “”.
Widget contents. Does not support patterns. Default value: “”.
If this property value is set to true, then the widget is visible.
Default value: true.
METHOD | RETURN | DESCRIPTION |
---|---|---|
cancel () | object
|
Sets the isBusy property to false |
destroy () | undefined
|
Destroys this widget |
get () | any
|
Get a property of the Stateful instance |
getParents () | array
|
Discover and return all parents of the widget |
placeAt () | dijit/_widgetbase
function
|
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions |
set (name) | aps/output
function
|
Override and refresh output on value change |
startup () | undefined
|
Gets started after the DOM fragment is added to the document |
Destroys this widget. Will also destroy any resources (including widgets) registered via this.own(). This method will also destroy internal widgets such as those created from a template.
Return: undefined
Get a property of the Stateful instance. Get a named property of the Stateful object. The property may potentially be retrieved via a getter method in subclasses.
In the base class, this just retrieves the object’s property.
Return: any
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions. A convenience function providing a simple shorthand mechanism to put an existing (or newly created) widget somewhere in the DOM, and allow chaining.
Return: dijit/_widgetbase function
Override and refresh output on value change.
Return: aps/output function
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
name |
undefined
|
The property to set. |
Gets started after the DOM fragment is added to the document Called after the widget and its children have been created and added to the page, and all related widgets have finished their create() cycle, up through postCreate().
Note that startup() may be called while the widget is still hidden, for example if the widget is inside a hidden dijit/Dialog or an unselected tab of a dijit/layout/TabContainer. For widgets that need to do layout, it’s best to put that layout code inside resize(), and then extend dijit/layout/_LayoutWidget so that resize() is called when the widget is visible.
Return: undefined
EVENT | RETURN | DESCRIPTION |
---|---|---|
onClick () | undefined
|
The method is called when a user clicks on the widget |
The method is called when a user clicks on the widget.