SingleSelectionModel

The selection model used by ListView and TreeView.

WARNING. At time of writing, selectedIndexProperty and selectedItemProperty do not change atomically. i.e. invalidation events can be fired for one of them before the value of the other has updated. So not read the value of selectedIndex or selectedItem within an InvalidationListener for the other. This issue does not manifest when using ChangeListeners.

T is the type of the elements in the items. If T is nullable, then extra care must be taken when using selectedItem. Change the selection to none, by setting selectedIndex to -1, rather than setting selectedItem to null. When reading selectedIndex, a null value has an indeterminate meaning (either no selection, or null is selected).

Constructors

Link copied to clipboard
constructor(items: ObservableList<T>)

Properties

Link copied to clipboard
Link copied to clipboard

Either -1 (nothing is selected) or the index of the selected item.

Link copied to clipboard
Link copied to clipboard

Either null (when nothing is selected), or the selected item.