ContextSwitcher

Current version: 9.0

The ContextSwitcher control displays a dropdown button that contains a panel of clickable items. When users click the button, the button displays the panel of items.

When users click an item in the panel:

  • If you specify an event in the Click property of the item, the control triggers this event (if applicable).

  • The content of the Text property of the item becomes the text that the ContextSwitcher control shows as its label.

Some page structures have a dedicated placeholder for the ContextSwitcher control: ApplicationHeader.ContextSwitch.

You specify the items that the ContextSwitcher control shows with the ContextItem template. This template has four fields that you use to specify the items:

  • Name: the control uses this as the label text of the button when this item is selected.

  • Click: specify the JavaScript that the control executes.

  • Tooltip: specify a tooltip text that the control uses when this item is selected.

  • Selected: set this field to true to make the item selected. You can also read the value to test if the item is currently selected.

The ContextSwitcher control does not support multiple selection. If more than one item has Selected == true, then the last of the items is the selected item. If no item has Selected == true, then the first of the items is the selected item.

You create items based on the ContextItem template in a folder under the PageSettings item of your application, and you must bind the Items property of the ContextSwitcher control to a data source component that retrieves these items. The ControlSwitcher control shows all these items.

You can populate the Items property in JavaScript, as is in this example:

RequestResponse
javascript: app.ContextSwitcher1.set("items", [{
    Name: "Alert",
    Click: "javascript:alert('clicked')"
}, {
    Name: "Tooltip",
    Tooltip: "This is the tooltip for the contextItem"
}, {
    Name: "Selected",
    Selected: true
}, {
    Name: "Trigger",
    Click: "trigger:open:SmartPanel1"
}])

Properties

Name

Description

Default

Data

Items

Specify the items that the control displays.

Configuration

You can use the ContextSwitcher-Parameters template to create a configuration item for the control.

Do you have some feedback for us?

If you have suggestions for improving this article,