Widgets.FacetsTable / Facets Table

In addition to the Widgets.Base these options are available in the API for the Facets Table widget.

Rendering

customCellTemplate

Specifies that a custom HTML template for the table cells should be used instead of the default one. Any of the custom templates uploaded with the custom widget can be assigned to this property directly.

 Example
Example
afterInitialize: function () {
	this.customCellTemplate = this.customResources['myTemplate.html'];
},

customHeaderTemplate

Equivalent technique as for the cell templates can be used to customize the table headers.

customDetailTemplate

Equivalent technique as for the cell templates can be used to customize the table item detail panels.

getCustomCellTemplateParams()

widget.getCustomCellTemplateParams(/* no arguments */)        EXTEND

The method is called when the HTML for table cells is being generated out of the custom cell template. It is expected to return an object with parameters which will be present in the scope of the template (passed into the template function).

 Example
Example JavaScript
getCustomCellTemplateParams: function () {
	return {
		myParam: 'squirro',
	};
},
Example HTML
<div>
	Welcome to the parametrised custom template.
	Value passed in: <%- myParam %>
</div>

getCustomHeaderTemplateParams()

widget.getCustomHeaderTemplateParams(/* no arguments */)      EXTEND

The method is called when the HTML for table cells is being generated out of the custom header template. It is expected to return an object with parameters which will be present in the scope of the template (passed into the template function).

getCustomDetailTemplateParams()

widget.getCustomDetailTemplateParams(/* no arguments */)      EXTEND

The method is called when item body is being generated. It is expected to return an object with parameters which will be present in the scope of the template (passed into the template function).

Additional variables exposed in the custom cell Facet Table templates

item

A Backbone model containing information about current item (row). Contains properties describing the item (e.g. title), as well as a few helper methods.

getThumbnailURL()

Returns the URL of the item thumbnail image, if present.

generateMailLink()

Returns a mailto: link containing basic information about the item ready for sharing.

getDisplayTime()

Returns the formatted creation date/time of the item.

getItemLink()

Returns a link to the item source, if present.

toggleStar()

Toggles the starred mode on the item.

markAsRead()

Marks item as read.

escape(property)

Mimics Backbone.Model.get(), but escapes the value to be displayed in HTML.

column

A Backbone model containing information about current table column.

name

Contains the column name, which is equal to the facet the column was configured with.

title

Contains the column title, which is a formatted version of the name.

widget

Contains a reference to a Backbone model with configuration of the custom widget.

Additional variables exposed in the custom header Facet Table templates

column

A Backbone model containing information about current table column. See "Additional variables exposed in the custom cell Facet Table templates" for more information.

Additional variables exposed in the custom item detail Facet Table templates

item

A Backbone model containing information about current item (row). See "Additional variables exposed in the custom cell Facet Table templates" for more information.

Interaction

disableClicks

Disable clicking on rows. (true|false)

onRowClick(e, this.model)

Function to run on click of a row.