CloudBlue Commerce API

Last updated 15-Jan-2021
  • API Overview
  • Using Platform Services
  • Integrating Cloud Services
  • Concepts
  • API Reference
    • APS Types
    • REST Interface
    • User Interface
      • Navigation
      • View Structure
      • JS Modules
        • Widget Categories
        • List of Widgets
        • aps/ActiveItem
        • aps/ActiveList
        • aps/alert
        • aps/bill/CreditCard
        • aps/biz/MainView
        • aps/biz/SubscriptionInfoTile
        • aps/biz/UsersCollection
        • aps/Button
        • aps/Carousel
        • aps/changePassword
        • aps/CheckBox
        • aps/ComboBox
        • aps/common
        • aps/confirm
        • aps/Container
        • aps/createCCPv2ViewForCCPv1
        • aps/DateTextBox
        • aps/declare
        • aps/DropDownButton
        • aps/FieldSet
        • aps/Gallery
        • aps/Gauge
        • aps/Grid
        • aps/Hr
        • aps/i18n/phone
        • aps/i18n
        • aps/InfoBoard
        • aps/json
        • aps/lang
        • aps/List
        • aps/ListItem
        • aps/ListSwitcher
        • aps/load
        • aps/Memory
        • aps/Message
        • aps/MessageList
        • aps/MultiLine
        • aps/MultiSelect
        • aps/nav/ViewPlugin
        • aps/nav/ViewPluginManager
        • aps/navigation
        • aps/Output
        • aps/PageContainer
        • aps/Panel
        • aps/parser
        • aps/passwdqc/generator
        • aps/passwdqc/passwdqc_check
        • aps/Password
        • aps/Pie
        • aps/PopupView
        • aps/ProgressBar
        • aps/query
        • aps/RadioButton
        • aps/ready
        • aps/ResourceStore
        • aps/Select
        • aps/Slider
        • aps/Spinner
        • aps/Status
        • aps/Store
        • aps/Switch
        • aps/Tab
        • aps/Tabs
        • aps/TextArea
        • aps/TextBox
        • aps/Tile
        • aps/tiles/PieTile
        • aps/tiles/UsageInfoTile
        • aps/Tiles
        • aps/Toolbar
        • aps/ToolbarButton
        • aps/ToolbarSeparator
        • aps/ToolsItem
        • aps/ToolsList
        • aps/Tooltip
        • aps/UsageInfo
        • aps/validate/number
        • aps/validate/phone
        • aps/validate/web
        • aps/View
        • aps/WidgetList
        • aps/WizardControl
        • aps/WizardData
        • aps/xhr
      • Polyfills
    • PHP Framework
    • Package Structure
  • Tools and Downloads
  • Glossary
  • What’s New

Previous topic

aps/Button

Next topic

aps/changePassword

aps/Carousel¶

This widget container is used to showcase some child widgets combined on one basis. The allowed child widget is ``aps/Tile``.

Table of contents

  • Compatibility

  • Overview

  • Examples

  • Public Properties

  • Public Methods

  • Public Events

Compatibility¶

UX1 only

Overview¶

aps/Carousel is a container used to present multiple child widgets in a horizontal line. The child widgets can be only aps/Tile. In a case not all tiles can be shown on a page due to the gridSize limitation, the scrolling controls allow scrolling the tiles horizontally grouping all tiles into pages.

../../../../../_images/carousel.png

The currentPage property presents the number of the currently displayed page starting from 1.

Child tiles can be defined using one of the two ways:

  • Create a data store that defines a number of children and their properties.

    In this case, it is necessary to define only one aps/Tile widget as a template. The actual number of child tiles in the carousel will be as many as the size of the data store array. The properties of the tiles are synced with the data store as defined in the template aps/Tile. This method is illustrated in the Examples.

  • Define every child tile separately with its own properties.

The getCurrentTiles method returns an array of objects presenting the properties of the tiles displayed on the current page:

  • When a data store is used in the carousel, every returned element in the array contains the full set of properties.

  • In the other case, a returned element contains only the title of the corresponding tile.

Examples¶

Simple Carousel¶

This is a simple carousel illustrating the horizontal scrolling of the tiles. You can play with the data store to change the number of tiles or to change the gridSize property in the aps/Tile definition.

RUN DEMO

require(["dojox/mvc/at", "aps/load", "aps/Memory", "aps/ready!"],
    function(at, load, Memory) {
        "use strict";
        var serviceData = [{
            title: "Mainstream cloud service",

            serviceDescription: "The most suitable for mainstream assignment."
        }, {
            title: "Light cloud service",
            serviceDescription: "The most suitable for mass assignment and free distribution."
        }, {
            title: "High level cloud service",
            serviceDescription: "Cloud service with almost all options."
        }, {
            title: "Top level cloud service",
            serviceDescription: "VIP cloud service with all possible options."
        }];
        var serviceStore = new Memory({
            data: serviceData
        });
        load(["aps/Carousel", {
            title: "Welcome to the newest cloud services!",
            description: "The most effective service and efficient ownership.",
            currentPage: 1,
            store: serviceStore
        },
            [
                ["aps/Tile", {
                    title: at("rel:", "title"),
                    gridSize: "md-4",
                    state: 'inactive',
                    serviceDescription: at("rel:", "serviceDescription")
                }]
            ]
        ]);
});

Getting Current Tiles¶

The following demo shows the use of the getCurrentTiles method triggered by the watch method in the moment, when the carousel is scrolled.

RUN DEMO

require([
    "dijit/registry",
    "dojox/mvc/at",
    "dojox/mvc/getStateful",
    "aps/load",
    "aps/Memory",
    "aps/ready!"
], function(registry, at, GetStateful, load, Memory) {
    "use strict";
    var serviceData = [{
        title: "Mainstream cloud service",
        serviceDescription: "The most suitable for mainstream assignment."
    }, {
        title: "Light cloud service",
        serviceDescription: "The most suitable for mass assignment and free distribution."
    }, {
        title: "High level cloud service",
        serviceDescription: "Cloud service with almost all options."
    }, {
        title: "Top level cloud service",
        serviceDescription: "VIP cloud service with all possible options."
    }];
    var serviceStore = new Memory({
        data: serviceData
    });
    var displayedDataModel = new GetStateful({
        data: []
    });

    function updateDisplay(name, oldVal, newVal) {
        console.log("Handler started - updateDisplay");
        //var data = registry.byId("myCarousel").getCurrentTiles();
        //displayedDataModel.set("data", data);
    }

    load([
        ["aps/Carousel", {
            id: "myCarousel",
            title: "Welcome to the newest cloud services!",
            description: "The most effective service and efficient ownership.",
            currentPage: 0,
            store: serviceStore
        },
            [
                ["aps/Tile", {
                    title: at("rel:", "title"),
                    gridSize: "md-4",
                    state: 'inactive',
                    serviceDescription: at("rel:", "serviceDescription")
                }]
            ]
        ],
        ["aps/WidgetList", {
            id: "currentData",
            title: "Current data on the page:",
            children: at(displayedDataModel, "data")
        },
            [
                ["aps/Panel", [
                    ["aps/FieldSet", [
                        ["aps/Output", {
                            value: at("rel:", "title")
                        }],
                        ["aps/Output", {
                            value: at("rel:", "serviceDescription")
                        }]
                    ]]
                ]]

            ]
        ]
    ]).then(function() {
        registry.byId("myCarousel").watch("currentPage", updateDisplay);
    });
});

Public Properties¶

PROPERTY

TYPE

DEFAULT

DESCRIPTION

currentPage

number

1

The number of the current page in the carousel.

description

string

“”

Text under the header of the Carousel and over the content of the Carousel.

disabled

boolean

false

Specifies if the widget will respond to user input.

extendedId

boolean

false

If it is true the widget’s id will be extended.

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.

store

aps/store

null

An instance of the “aps/Store” model, from which to fetch data.

title

string

“”

Text that is shown in the header of the Carousel.

visible

boolean

true

If this property value is set to true, then the widget is visible.

currentPage number¶

The number of the current page in the carousel. If currentPage < 1 the cuurent page will be the first one. If currentPage more than the last page number the cuurent page will be the last one. Default value: 1.

description string¶

Text under the header of the Carousel and over the content of the Carousel. Default value: “”.

disabled boolean¶

Specifies if the widget will respond to user input.

Default value: false.

extendedId boolean¶

If it is true the widget’s id will be extended. It can be useful when some widgets (e.g. aps/Tiles) use the same store with defined id-s. Default value: false.

gridSize string¶

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.

isBusy boolean¶

If the widget is busy then this property is true.

Default value: false.

label string¶

Text that is shown as a label if the widget is placed inside a aps/FieldSet.

Default value: “”.

store aps/store¶

An instance of the “aps/Store” model, from which to fetch data. Default value: null.

title string¶

Text that is shown in the header of the Carousel. Default value: “”.

visible boolean¶

If this property value is set to true, then the widget is visible.

Default value: true.

Public Methods¶

METHOD

RETURN

DESCRIPTION

addChild (child, insertIndex)

undefined

Adds a given widget to the list

cancel ()

object

Sets the isBusy property to false

destroy ()

undefined

Destroys this widget

focus ()

aps/_containerbase
function

Focusing the focusable child

get ()

any

Get a property of the Stateful instance

getChildren ()

array

Returns all direct children of this widget, i

getCurrentTiles ()

array

Returns an array of current tiles in the carousel

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

refresh ()

undefined

Refreshes a page

removeAll ()

undefined

Remove all children in the widget

removeChild (widget)

undefined

Removes the passed widget instance from this widget and destroys it

reset ()

undefined

Resets the widget

set ()

object
function

Set a property of the Stateful instance

startup ()

validate ()

boolean

Called by oninit, onblur, and onkeypress

addChild¶

Adds a given widget to the list. Inserts the DOM node of a specified widget as a child to the container DOM node and possibly does other processing (such as layout).

Return: undefined

ARGUMENT

TYPE

DESCRIPTION

child

Widget

Child widget

insertIndex

Number
String

Child position in the parent node

cancel¶

Sets the isBusy property to false.

Return: object

destroy¶

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

focus¶

Focusing the focusable child

Return: aps/_containerbase function

get¶

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

getChildren¶

Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it returns not all descendetns, but only the direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

Note the returned array is a simple array. The application code should not assume existence of methods like forEach().

Return: array

getCurrentTiles¶

Returns an array of current tiles in the carousel. Returns an array of objects. Every object contains properties of the appropriate active tile in the carousel.

Return: array

getParents¶

Discover and return all parents of the widget.

Return: array

placeAt¶

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

refresh¶

Refreshes a page.

Return: undefined

removeAll¶

Remove all children in the widget.

Return: undefined

removeChild¶

Removes the passed widget instance from this widget and destroys it. You can also pass in an integer indicating the index within the container to remove (ie, removeChild(5) removes the sixth widget).

Return: undefined

ARGUMENT

TYPE

DESCRIPTION

widget

Widget
Int

Child widget or index

reset¶

Resets the widget.

Return: undefined

set¶

Set a property of the Stateful instance. Sets named properties of the stateful object and notifies the watchers of the property. A programmatic setter may be defined in subclasses.

Return: object function

startup¶

validate¶

Called by oninit, onblur, and onkeypress. Show missing or invalid messages if appropriate, and highlight textbox field.

Return: boolean

Public Events¶

EVENT

RETURN

DESCRIPTION

onClick ()

undefined

The method is called when a user clicks on the widget

onClick¶

The method is called when a user clicks on the widget.

← aps/Button
aps/changePassword →
© 2020 Ingram Micro, Inc. All Rights Reserved. Privacy Policy Terms of Use Platform Services About CloudBlue Support Contacts