Presents objects from a data source in one of two view modes at a time.
The widget defines a pair of containers. In PCP / CCP v1, they are ``aps/Grid`` and ``aps/ActiveList``. In CCP v2, they are ``aps/Grid`` and ``aps/Tiles``. A user can switch from one view mode to another.
Table of contents
All user panels - CP and UX1
The aps/ListSwitcher
object contains definition of two presentation formats (view modes).
It is used to present a collection of objects from a data model in one of these formats at a time
as in the following example:
Depending on the control panel version, it is possible to use the following pairs of presentation formats:
For CP, use the aps/Grid and aps/ActiveList pair.
List of servers displayed in the aps/Grid
view mode:
Same list in the aps/ActiveList
view mode:
For UX1, use the aps/Grid and aps/Tiles pair:
Find the nested rules for this widget in the recommended Widget Hierarchy.
Warning
If the number of elements is less or equal the number of
columns in aps/ActiveList
, then the menu for choosing sorting and
view mode will not be visible.
The aps/ListSwitcher
widget stores the view mode and sorting configuration
used in the current session. When you open the same screen next time, the saved
session state is restored. If you need to open the screen always in a predefined
state, you should create needed settings in the screen code by means of
the set
method.
PROPERTY |
TYPE |
DEFAULT |
DESCRIPTION |
---|---|---|---|
boolean |
false |
Specifies if the widget will respond to user input. |
|
string |
undefined |
This specifies the widget width that is relevant only for widgets inside Container, FieldSet, or Tiles. |
|
boolean |
false |
The display mode. |
|
boolean |
false |
If the widget is busy then this property is true. |
|
string |
“” |
The source name that is used for the sort operations. |
|
boolean |
<strong>false</strong> (Ascending) |
Defines the sort direction: true - Descending, false - Ascending. |
|
boolean |
true |
If this property value is set to true, then the widget is visible. |
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.
The display mode. If the property value is true, the data is displayed as aps/Grid. The default value is false.
The source name that is used for the sort operations. Specifies the field that will be used for sorting in the ``aps/ActiveList`` view mode. Deprecated for CCP v2. Default value: “”.
Defines the sort direction: true - Descending, false - Ascending. Default value: false (Ascending). Deprecated for CCP v2.
If this property value is set to true, then the widget is visible.
Default value: true.
METHOD |
RETURN |
DESCRIPTION |
---|---|---|
undefined
|
Makes the given widget a child of this widget |
|
object
|
Sets the isBusy property to false |
|
undefined
|
Destroys this widget |
|
aps/_containerbase
function
|
Focusing the focusable child |
|
any
|
Get a property of the Stateful instance |
|
array
|
Returns all direct children of this widget, i |
|
array
|
Discover and return all parents of the widget |
|
dijit/_widgetbase
function
|
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions |
|
undefined
|
Refresh data in widget |
|
undefined
|
Remove all children in the widget |
|
undefined
|
Removes the passed widget instance from this widget and destroys it |
|
undefined
|
Resets the widget |
|
object
function
|
Set a property of the Stateful instance |
|
boolean
|
Called by oninit, onblur, and onkeypress |
Makes the given widget a child of this widget. Inserts specified child widget’s dom node as a child of this widget’s container node, and possibly does other processing (such as layout).
Return: undefined
ARGUMENT |
TYPE |
DESCRIPTION |
---|---|---|
|
Widget
|
Child widget |
|
Number
String
|
Position child in the parent widget |
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
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
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
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
Int
|
Child widget or index |
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
Called by oninit, onblur, and onkeypress. Show missing or invalid messages if appropriate, and highlight textbox field.
Return: boolean
EVENT |
RETURN |
DESCRIPTION |
---|---|---|
undefined
|
The method is called when a user clicks on the widget |
The method is called when a user clicks on the widget.