Q4Widgets API Documentation

q4.documentLibrary

A library of download list documents.
Tagging Architecture
library tag - A unique tag used to add documents to the library. This can be set by updating the libraryTag option.
filter tag - tags to be used by a filter. These tags contain an underscore which separates the tagSelector from tag value. The tagSelector should be used to configure the filter in the filters option.
(ex: type_report, location_canada, location-region_toronto)
If the tagSelector contains a "-" then it will override the filter whose tagSelector is set to the text before the "-". For example for location-region_toronto, location-region filters will override location filters.
field tag - all other tags that aren't considered a filter tag or the library tag. Use "-" to signify a space between words.
(ex: corporate-governance, annual-report)
Script link
q4.documentLibrary.1.0.1.min.js
Source file
q4.documentLibrary.js, line 2
Requires

Options

url string
The base URL to use for API calls. By default, calls go to the current domain, so this option is usually unnecessary.
languageId string
A number representing which language to pull data from. By default the widget will attempt to auto-detect the language.
Example
'1'
libraryTag string
The tag applied to each Download List item that should be included in the library.
Default value
dl
filters Array.<object>
An array of filter configurations for the library. Configuration options: title - the text that should be applied to the filter's label, type - supported types of filters include dropdown, checkbox, daterange, links containerCls - A selector for where the filter should be appended tagSelector - the prefix applied to the tags for the filter. If tagSelector is set to "" field tags will be used. useTags - This field is optional, if used it is an array of tags (string) that should be displayed within the filter. It can be used to override showing all the tags within the filter. If you are using this option for a filter tag you will not need to add the tagSelector portion of the tag (as this should already specified in the tagSelector option).
Default value
[]
Example
{
    title: "Documents", 
    type: "dropdown", 
    containerCls: '.module_filter--documents', 
    tagSelector: "type",
    useTags: ["committee-charter", "newsroom"]
}
linkFilterLimit number
Limit for filters of the type "links". For link filters displaying field tags, the field tags will be sorted based on the amount of times they occur. This will have no affect if the useTags option is being used in the filter configuration.
Default value
20
dateRangePickerOptions object
Configurable options for Date Range Picker. Used for daterange filters. Date Range Picker Options
Default value
{}
fieldTagPrefix string
Field Tag prefixes to be used in the generated URL query string.
Default value
field
clearFilterTrigger string
A selector for the clear filter button.
Default value
.filter_clear
searchBarCls string
A selector for the search bar.
searchBarCls string
A selector for the search button.
tagsReplacementText Array.<string>
An array of texts that should be displayed for tags. By default the tags will be capitalized. Use this to set the text for tags that need to be corrected.
Default value
[]
Example
['Non-GAAP Reconciliation', 'Non-GAAP', 'GTA']
checkboxTpl string
A Mustche.js template for checkbox filters. The filter template may contain the following Mustache variables:
  • {{title}} - The title of the filter
  • {{tagSelector}} - The tagSelector used for this filter
  • {{items}} - An array of tags.
    • {{tag}} - the tag value
    • {{text}} - the text to display for the tag
dropdownTpl string
A Mustche.js template for dropdown filters.
  • {{title}} - The title of the filter
  • {{tagSelector}} - The tagSelector used for this filter
  • {{items}} - An array of tags.
    • {{tag}} - the tag value
    • {{text}} - the text to display for the tag
daterangeTpl string
A Mustche.js template for daterange filters.
  • {{title}} - The title of the filter
  • {{tagSelector}} - The tagSelector used for this filter
  • linksTpl string
    A Mustche.js template for link filters.
    • {{title}} - The title of the filter
    • {{tagSelector}} - The tagSelector used for this filter
    • {{items}} - An array of tags.
      • {{tag}} - the tag value
      • {{text}} - the text to display for the tag
    template string
    A Mustche.js template for the document library results. variables include:
  • {{ContentAssetId}}
  • {{Description}}
  • {{FilePath}}
  • {{FileSize}}
  • {{FileType}}
  • {{IconPath}}
  • {{LanguageId}}
  • {{Lookup}}
  • {{LookupWorkflowId}}
  • {{RevisionNumber}}
  • {{TagsList}} - a list of all tags
  • {{ThumbnailPath}}
  • {{Type}}
  • {{TypeCls}} - this class correlates to the Report Type that the document is listed under.
  • {{WorkflowId}}
  • {{ContentAssetDate}}
  • {{tags}} - tags sorted by whether they are considered a field tag or filter tag
    • {{filterTags}} - an array of filter tags seperated by their type of filter. The key of each object is the type of filter tag and the value is an array of tags for that fall under that filter
    • {{fieldTags}} - a list of field tags
    • {{fieldTagsText}} - same as {{fieldTags}} but each tag is a object containing the value (tag) and the text format (text)
    • {{fieldTags}} - same as {{filterTags}} but each tag is a object containing the value (tag) and the text format (text)
  • TagsTextList - a list of all tags with thier corresponding text formats
    • {{tag}} - the tag value
    • {{text}} - the text to display for the tag
    • {{is_}} - Boolean (set to true), where the text that appears after the _ will vary based on the filterTag type. Ex) is_type, is_location, is_location-region.
  • loadingClass string
    A CSS class to add to the widget while data is loading. This can be used to show and hide elements within the widget.
    loadingMessage string
    A message or HTML string to display while first loading the widget.
    Default value
    <p class="module_loader"><i class="q4-icon_spinner"></i><span class="sr-only">Loading ...</span></p>
    pagerContainer string
    A selector for where the pager should be appended.
    Default value
    .pager_list
    defaultPageSize number
    The number of items to display per page.
    Default value
    10
    pageRangeSize number
    The number of pages to display at once.
    Default value
    5
    showPrevNext boolean
    Whether to show previous/next page triggers.
    Default value
    true
    showFirstLast boolean
    Whether to show first/last page triggers.
    Default value
    true
    pageLabels Object
    The text to display for first/last/previous/next page triggers.
    Default value
    {"prev":"<","next":">","first":"<<","last":">>"}
    pagerItemTpl string
    A template for each page trigger.
    Default value
    <li data-value="{{page}}" class="{{pageCls}}">{{text}}</li>
    pagerTrigger string
    A selector for each page trigger.
    Default value
    li
    docNumberDisplayCls string
    A selector for where to display the total documents.
    Default value
    .module_container-docnumber
    docNumberDisplayTpl string
    A template for the current page, total page, & total number of documents. variables included:
    • {{currentPage}} - the index of the current page.
    • {{totalPages}} - the number of total pages.
    • {{currentDocuments}} - the total number of documents returned by the filters.
    fancyboxTrigger string
    A selector for fancybox trigger within the template.
    Default value
    .fancybox
    fancyboxTpl string
    A template for the fancybox popup.
    • {{title}} - the title of the document.
    • {{url}} - the url for the document.
    • {{relativeUrl}} - the relative path for the document, uses the relativeLevel option.
    fancyboxOpts Object
    Configurable options for the library's fancybox. Fancybox Options
    relativeLevel string
    Relative level can be change if the index.html is not uploaded to the default location (/files/js/pdf-js)
    Default value
    ../../
    onFilterChange function
    A callback that gets fired when a filter is updated.
    Parameters
    event Event
    The event object.
    templateData Object
    The object containing the filters being applied.
    beforeRender function
    A callback that gets fired before the full widget is rendered. This function only runs once (on initial load).
    Parameters
    event Event
    The event object.
    templateData Object
    The data for the documents being rendered.
    beforeRenderItems function
    A callback that gets fired before the items list is rendered.
    Parameters
    event Event
    The event object.
    templateData Object
    The data for the documents being rendered.
    itemsComplete function
    A callback that gets fires after the item list is rendered.
    Parameters
    event Event
    The event object.
    complete function
    A callback that gets fires after the entire widget is rendered. This function only runs once (on initial load).
    Parameters
    event Event
    The event object.