Widget for searching items in BlueConic.
It's a dialog that shows all navigable items in BlueConic, that can be selected.
The select
event will return the selected item(s).
Example
require(["blueconic/api/widgets/dialog/SearchAndSelectDialog", "dojo/on"], function(SearchAndSelectDialog, on) {
const widget = new SearchAndSelectDialog({
isMultiple: true, // can multiple items be selected or not
hiddenFacets: ["type"], // when filter on content type shouldn't be shown
selectedFacetValues: [{facet:'type', value:'user'}], // only show users in the results
title: "title of the dialog"
});
widget.own(
on(widget, "select", (items) => {
// do something with the selected items
})
);
widget.startup();
widget.show();
});
Properties
-
hiddenFacets Array.<String>
-
Array of facets which are hidden: eg when I want only to search for images, I do not want a content type widget. Eg: ["type"]
-
isMultiple boolean
-
If the search and select dialog should allow for multiple items to be selected.
-
selectedFacetValues Array.<String>
-
Array with selected facet values, eg: [{facet:'type', value:'user'}]
-
selectedItems Array.<blueconic.api.data.domain._Base>
-
Selected items in the search pane.
-
showAll boolean
-
Whether to show items that the user doesn't have permissions to (role based).
-
title String
-
The title of the dialog.
Functions
-
hide()
-
Hide the search and select dialog.
-
show()
-
Show the search and select dialog.
-
update(query, excludeIds)
-
Update the parameters of the search dialog.
Name Type Description query String the term to search on in the dialog
excludeIds Array.<String> the item IDs to exclude in the results
Events
-
onClose()
-
When the user closed the dialog.
-
onSelect(selectedItems)
-
When the user has made a selection in the search pane and clicked at the Select button, this function is called.
Name Type Description selectedItems blueconic.api.data.domain._Base | Array.<blueconic.api.data.domain._Base> the selected item(s)