3.5.5.1Checkbox list

SelectFromList() can also be used to display a list of items with checkboxes, where the user can then select multiple items rather than a single item.

There are two requirements in order to use SelectFromList() in this way: the options for SelectFromList() must include checkboxes:true, and the items[] array must contain objects where each one has id and caption members (in addition to any other data which you want to receive back from the dialog). For example:

Framework.SelectFromList({

title: "Which do you want?",

checkboxes: true,

items: [

{id: "item1", caption: "Item 1"},

{id: "item2", caption: "Item 2", checked: true}, // Checked by default

{id: "item3", caption: "Item3", someExtraPrivateData: "x2"}

]

}, function (selection) {

// Either null, or an array of the checked items

});

The return value from SelectFromList() is an array of the checked items (rather than a single selection).

By default, the dialog's Save button is/remains enabled even if no items are checked (and the return value is then an empty array). If you want to prevent this, and to force the user either to cancel the dialog or to select at least one item, then you can specify checkboxesPreventNone: true in the options for SelectFromList().