On small screens such as mobile phones, the framework modifies pop-up menus in widgets so that they are instead displayed as a list in a dialog. This way of presenting a choice of values is also available as the
Framework.MenuListDialog({
title: "My list",
items: [
{text: "Item 1", actionData: "some value"},
{text: "Item 2", checkbox: true, separator: true, id: 98},
{text: "Disabled item", disabled: true},
{text: "Has a sub-menu", icon: "xf002", items: [
{text: "Sub item 1", color: "red", id: 37},
{text: "Sub item 2", icon: "xf00d", id: 43}
]},
]
}, function (Msg) {
if (Msg.result && Msg.result.itemData) {
// User made a selection. Selected item is in Msg.result.itemData
}
});
The definition of the list can have a
Each entry in the
| Property | Description |
| text | Text to display for the item |
| items:[] | Optional array of sub-items, as in the example above. The menu can have any level of nesting: sub-menus which have sub-menus which have sub-menus etc. |
| disabled | If |
| unselectable | If |
| separator | If |
| separatorAfter | If |
| icon | Icon to display next to the item. This can be the hexadecimal code of any Font Awesome icon, prefaced with |
| checkbox | If not null, the item is given either a ticked ( |
| checked | If not null, the item is given either a unfilled ( |
| color | Overrides the text colour using a normal CSS colour value such as "red" or "#FF0000" |
| iconColor | Overrides the icon colour using a normal CSS colour value such as "red" or "#FF0000" |
| backgroundColor | Overrides the background colour for the item's row using a normal CSS colour value such as "red" or "#FF0000" |
Each entry in the array can also have any number of other properties for your own reference, such as
Your callback function is called twice: once with initialisation data which gives you the ID of the dialog, and a second time with the result of the dialog: either the user's selection, or cancellation.
The final result callback has a
if (Msg.result && Msg.result.itemData) {
// User has made a selection
} else {
// Initial update message, or user cancelled the dialog without response
}