A class which contains popup APIs.
⚠ If you want to remove an item in a popup, use disableElements.
⚠ If you want to remove an item in a popup, use disableElements.
Methods
-
add(items [, dataElement])
-
Add an array of items after the item that has the given data element.
Parameters:
Name Type Argument Description items
Array.<object> Same as header items dataElement
string <optional>
An optional string. If not given, items will be added in the beginning Returns:
The instance itself- Type
- this
Example
WebViewer(...) .then(function(instance) { instance.contextMenuPopup.add({ type: 'actionButton', img: 'path/to/image', onClick: instance.downloadPdf, }); });
-
getItems()
-
Return the array of items in the popup.
Returns:
Current items in the popup.- Type
- Array.<object>
Example
WebViewer(...) .then(function(instance) { instance.annotationPopup.getItems(); });
-
update( [items])
-
Update all the items in the popup. To update an individual item, use updateElement
Parameters:
Name Type Argument Description items
Array.<object> <optional>
the items that will be rendered in the popup Returns:
The instance itself- Type
- this
Example
WebViewer(...) .then(function(instance) { // replace existing items with a new array of items instance.contextMenuPopup.update([ { type: 'actionButton', img: 'path/to/image', onClick: instance.downloadPdf, }, { type: 'actionButton', img: 'path/to/image', onClick: instance.print, }, ]); });