Support Menu

Coveo component Quickview

This component is meant to exist within a result template. It allows to create a button/link inside the result list that opens a modal box for a given result.

Most of the time, this component will reference a QuickviewDocument in its content template.

Choosing what to display for the Quickview

The Quick View uses any HTML structure you put inside its tag and uses that as the content of the dialog box. This content can thus be any element you decide, using your CSS and your structure.

Example

  • You can change the appearance of the Quick View link by adding HTML inside the body of the div.

  • You can change the content of the Quick View link by specifying a template ID.

  • You can use the methods of the CoreHelpers in the template.

<!-- This would change the appearance of the quickview button itself in the result. -->
<div class="CoveoQuickview" data-template-id="TemplateId">
  <span>Click here for Quickview</span>
</div>

<!-- This would modify the content of the quickview when it is opened in the modal box -->
<script class='result-template' type='text/underscore' id='TemplateId' >
  <div>
    <span>This is the content that will be displayed when you open the Quick View. You can also include any other Coveo components.</span>
    <table class="CoveoFieldTable">
      <tr data-field="@liboardshorttitle" data-caption="Board" />
      <tr data-field="@licategoryshorttitle" data-caption="Category" />
      <tr data-field="@sysauthor" data-caption="Author" />
    </table>
  </div>
</script>

<!-- Note that this is all optional: Just including a <div class='CoveoQuickview'></div> will do the job most of the time, and will include a default template and default button appearance -->

Index

Component Options

alwaysShow

alwaysShow: boolean

Specifies whether the quickview is always shown, even when the index body for a document is empty.
In such cases, the Quickview.options.contentTemplate specifies what appears in the quickview.
If there is no quickview for the document, you MUST specify a contentTemplate otherwise the component will throw an error when opened.

Markup configuration example(s) :
data-always-show='true'
data-always-show='false'

contentTemplate

contentTemplate: Template

Specifies the template to use to present the Quick View content in the modal window.
e.g.:

showDate

showDate: boolean

Specifies whether to show the document date in the Quick View modal window header.
The default value is true.

Markup configuration example(s) :
data-show-date='true'
data-show-date='false'

size

size: string

Specifies the Quick View modal window size (width and height) relative to the full window.
The default value is 95% on a desktop and 100% on a mobile device.

Markup configuration example(s) :
data-size='foo'

title

title: string

Specifies the title of your choice that appears at the top of the Quick View modal window.

Markup configuration example(s) :
data-title='foo'

Methods

close

  • close(): void

debugInfo

  • debugInfo(): any

disable

  • disable(): void
  • Disable the component. Normally this means that the component will not execute handlers for the framework events (query events, for example). Component are enabled by default on creation.

    Returns void

enable

  • enable(): void
  • Enable the component. Normally this means that the component will execute handlers for the framework events (query events, for example). Components are enabled by default on creation.

    Returns void

getBindings

open

  • open(): void

Static get

  • get(element: HTMLElement, componentClass?: any, noThrow?: boolean): BaseComponent
  • Get the bound component to the given HTMLElement. Throws an assert if the HTMLElement has no component bound, unless using the noThrow argument.
    If there is multiple component bound to the current HTMLElement, you must specify the component class.

    Parameters

    • element: HTMLElement

      HTMLElement for which to get the bound component.

    • Optional componentClass: any

      Optional component class. If the HTMLElement has multiple components bound, you must specify which one you are targeting.

    • Optional noThrow: boolean

      Boolean option to tell the method to not throw on error.

    Returns BaseComponent

Properties

bind

Allows the component to bind events and execute them only when it is enabled.

type

{Coveo.ComponentEvents}

componentOptionsModel

componentOptionsModel: ComponentOptionsModel

Contains the state of options for differents component. Mainly used by ResultLink.

componentStateModel

componentStateModel: ComponentStateModel

Contains the state of different component (enabled vs disabled). Allows to get/set values. Trigger component state event when modified. Each component can listen to those events.

disabled

disabled: boolean

A disabled component will not participate in the query, or listen to ComponentEvents.

type

{boolean}

logger

logger: Logger

Allows component to log in the dev console.

queryController

queryController: QueryController

Contains the singleton that allows to trigger queries.

queryStateModel

queryStateModel: QueryStateModel

Contains the state of the query. Allows to get/set values. Trigger query state event when modified. Each component can listen to those events.

root

root: HTMLElement

A reference to the root HTMLElement (the SearchInterface).

searchInterface

searchInterface: SearchInterface

A reference to the root of every component, the SearchInterface.

usageAnalytics

usageAnalytics: IAnalyticsClient

A reference to the Analytics.client.

Static ID

ID: string

The static ID that each component need to be identified.
For example, SearchButton -> static ID : SearchButton -> className : CoveoSearchButton

Constructors

constructor

  • Create a new Component. Resolve all IComponentBindings if not provided.
    Create a new Logger for this component. Attach the component to the SearchInterface.

    Parameters

    • element: HTMLElement

      The HTMLElement on which to create the component. Used to bind data on the element.

    • type: string

      The unique identifier for this component. See : IComponentDefinition.ID. Used to generate the unique Coveo CSS class associated with every component.

    • Default value bindings: IComponentBindings = {}

      The environment for every component. Optional, but omitting to provide one will impact performance.

    Returns Quickview