Table Of Contents

Application Packaging Standard

Last updated 18-Mar-2019

aps/load

Provides the ability to create widgets “semi-declaratively” using JSON.

Return: dojo/deferred instance

Table of contents

Compatibility

All user panels - CP and UX1

Examples

Simple Button Declaration

load(["aps/Button", { label: "load from JSON" }], "loadFromJSON");

Complex Declaration

``aps/FieldSet`` inside of ``aps/Container``:

load(
   [ { id:"sample" }, [
      ["aps/Panel", { cols: 2 }, [
         ["aps/FieldSet", { title: "Server Information" }, [
            ["aps/Output", { label: "OS", content: "CentOS" }],
            ["aps/Output", { label: "Source Image", content: "Silver" }]
         ]]
      ]]
   ]],
   "main"
);

Parameters

ARGUMENT TYPE DESCRIPTION
def
undefined

JSON object that declares a widget. A widget is declared as an array with a special structure:

[
0: function (reference to the widget constructor)
        OR String (AMD module name)
        OR String (dom tag name wrapped with "less-than" and "greater-then" signs, e.g. <div>)
1: OPTIONAL: object
    widget properties OR dom node attributes
2: OPTIONAL: array
    declarations of child widgets or dom elements
]

An array of widgets can be passed as the first argument. The load module will iterate through each widget declaration.

Each widget declaration should have the same format as described above.

placeAt
undefined
dom node OR id OR widget (of container category) to place this widget in