ASPxClientListBox.GetSelectedItems Method
Returns an array of the list editor’s selected items.
#Declaration
GetSelectedItems(): ASPxClientListEditItem[]
#Returns
Type | Description |
---|---|
ASPx |
An array of ASPx |
#Remarks
Use the GetSelectedItems method to obtain an array of the selected items within a list box. A null value indicates that no item is currently selected within the list editor.
Note
The Get
For more information about multiple selection, read the Multi-Selection Mode topic.
#Example
The following section of the Moving Items Between Two List Boxes online demo illustrates how moving ASPxListBox items is implemented using the client ASPxClientListBox.GetSelectedItems
, ASPxClientListBox.AddItem, ASPxClientListBox.RemoveItem, ASPxClientListBox.BeginUpdate and ASPxClientListBox.EndUpdate methods.
function AddSelectedItems() {
MoveSelectedItems(lbAvailable, lbChoosen);
...
}
function RemoveSelectedItems() {
MoveSelectedItems(lbChoosen, lbAvailable);
...
}
function MoveSelectedItems(srcListBox, dstListBox) {
srcListBox.BeginUpdate();
dstListBox.BeginUpdate();
var items = srcListBox.GetSelectedItems();
for(var i = items.length - 1; i >= 0; i = i - 1) {
dstListBox.AddItem(items[i].text, items[i].value);
srcListBox.RemoveItem(items[i].index);
}
srcListBox.EndUpdate();
dstListBox.EndUpdate();
}