This module can be mixed into widgets that need to maintain the state of any selected items. Item selection is typically actioned by either individual Selector widgets in a list or by a menu action such as the ones provided by the AlfSelectDocumentListItems.
Mixing modules should call the createSelectedItemSubscriptions on creation to keep track of selected items. The can also call the publishSelectedItems function to broadcast the details of changes to item selection.
- Since:
- 1.0.39
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Members
-
currentlySelectedItems :object
-
This is used to keep track of the items that are currently selected. onItemSelected adds items and the onItemDeselected removes them. The itemKeyProperty is used as the key and the entire item is the value.
Type:
- object
- Default Value:
- null
- Source:
-
debounceTime :number
-
The number of milliseconds to wait after a selection event before publishing the latest selected item data.
Type:
- number
- Default Value:
- 50
- Source:
-
disableWhenNothingSelected :boolean
-
Indicates whether or not the disable function should be called when no items are selected.
Type:
- boolean
- Default Value:
- false
- Source:
-
itemKeyProperty :string
-
This is the dot-notation addressed property within the selection/de-selection publication payload that uniquely identifies the item.
Type:
- string
- Default Value:
- "node.nodeRef"
- Source:
-
previouslySelectedItems :object
-
This is assigned the currentlySelectedItems when item selection is cleared. If the retainPreviousItemSelectionState function is called then these items will be compared against the supplied list for consideration to be republished.
Type:
- object
- Since:
- 1.0.47
- Default Value:
- null
- Source:
-
selectedItems :object[]
-
An array of the currently selected items.
Type:
- object[]
- Default Value:
- null
- Source:
-
selectionTimeout :number
-
This is used to keep a reference to a timeout that is started on the publication of a selected document topic. It is important that multiple selection events can be captured so that only one publication of selected items occurs.
Type:
- number
- Default Value:
- null
- Source:
Methods
-
createSelectedItemSubscriptions()
-
- Source:
-
deferredSelectionHandler()
-
This is called from onItemSelected when the selectionTimeout times out. It resets the selectionTimeout to null and calls onSelectedItemsChanged
- Source:
-
onItemDeselected(payload)
-
Updates the array of documents that are currently selected.
Parameters:
Name Type Description payload
object The details of the item selected - Source:
-
onItemSelected(payload)
-
Updates the aray of documents that are currently selected.
Parameters:
Name Type Description payload
object The details of the document selected - Source:
-
onItemSelectionCleared(payload)
-
This clears the currently selected items. It it bound to the CLEAR_SELECTED_ITEMS topic that is published by the AlfSelectedItemsMenuItem when clicked.
Parameters:
Name Type Description payload
object This is not expected to contain any usable data. - Source:
-
onSelectedItemsChange(payload)
-
Tracks the currently selected items and stores them as the selectedItems variable.
Parameters:
Name Type Description payload
object A payload expected to contain a "selectedItems" attribute - Source:
-
publishSelectedItems()
-
This is called from the deferredSelectionHandler function and publishes on the [selectedDocumentsChangeTopic] module:alfresco/documentlibrary/_AlfDocumentListTopicMixin#selectedDocumentsChangeTopic.
- Source:
Fires:
-
retainPreviousItemSelectionState(items)
-
This function can be called to determine whether it is necessary to republish any items that were previously selected before item selection was cleared. The previously selected are compared against the array of items provided and any that were previously selected will be re-published as the currently selected items.
Parameters:
Name Type Description items
object[] The items to check for the selected items among - Since:
- 1.0.47
- Source:
Fires:
-
setDisabled(disable)
-
This function is called if disableWhenNothingSelected is configured to be true and a selection update occurs that results in no items being selected. By default it will attempt to toggle the disable state of the widget.
Parameters:
Name Type Description disable
boolean Indicates whether to disable or enable the widget - Source: