Skip to main content

list.tile.view

ListTileView : d2/sdk/widget/list.tile/list.tile.view

Base class for all list type of tiles in D2 Smart View landing perspective.

Extends: Marionette.CollectionView
Example (A minimum sample list derivative may look like)

//In mybundle/widgets/my.tile/my.tile.view.js
define([
'd2/sdk/widgets/list.tile/list.tile.view',
'mybundle/utils/contexts/factories/sample.tile.collection.factory'
], function(ListTileView, SampleTileCollectionFactory){
'use strict';

var SampleListTileView = ListTileView.extend({
constructor: function SampleListTileView(options) {
options = options || {};
options.collectionFactory = SampleTileCollectionFactory;

SampleListTileView.__super__.constructor.call(this, options);
}
});

return SampleListTileView;
});

Example (To link this definition to the list of tiles looked up at landing page resolution time)

//in mybundle/extensions/landing.tiles.js
define([], function(){
'use strict';

return [{
...
tileView: 'mybundle/widgets/my.tile/my.tile.view',
...
}];
});

Example (Then finally the extension is registered in extension.json as)

{
"d2/sdk/utils/landingpage/tiles": {
"extensions": {
"mybundle": {
"mybundle/extensions/landing.tiles"
}
}
}
}

listTileView.getFactoryParam() ⇒ string

Get the name of factory param if this list view is backed by a collection factory. For easy coupling factory param should be given a name same as the propertyPrefix of the backing collection facatory.

Kind: instance method of ListTileView
Returns: string - Should return the factory param name.

listTileView.onClickItem(target) ⇒ void

Handles what happens when a list item is clicked or equivalne user interaction happens. The default implementation executes default action associated with the list item.

Kind: instance method of ListTileView

ParamTypeDescription
targetMarionette.View

View instance associated with the item being clicked.

listTileView.onClickHeader() ⇒ void

Handles what happens when the tile's header is clicked. The default implementation tries to open up linked application scope perspective, if any. Setting a special constructor option avoidOpenPerspectiveOnHeader to true prevents the default behavior from happening.

Kind: instance method of ListTileView

ListTileView.extend(protoProperties, staticProperties) ⇒ function

To define a derived type from ListTileView.

Kind: static method of ListTileView
Returns: function - The derived type.

ParamTypeDescription
protoPropertiesobject

Properties attached to the prototype of derived type.

protoProperties.constructorfunction

The function to be used to construct instance of the derived type.

staticPropertiesobject

Properties statically attached to the derived type.

ListTileView~ListTileView

Kind: inner class of ListTileView

new ListTileView(options)

ParamTypeDescription
optionsobject

constructor options

[options.data]ListTileData

Generic purpose data. Defaults to nothing.

[options.collectionFactory]Factory

A collection factory reference that will be used to create the collection that holds the data for this tile. See Factory

[options.collection]Backbone.Collection

Reference to a collection instance to be used as data holder. Either one of collectionFactory or collection is required If both are present in options then precedence is given to collection.

[options.lang]object

Translation keys to be used for displaying labels associated with this tile.

[options.orderBy]string

Default sorting order for the data to be displayed in this tile. Defaults to name asc i.e sort by item names in ascending order.

[options.showTitleIcon]Boolean

Whether to show/hide icon for this tile. Defaults to true.

[options.context]Context

The application context. See Context

[options.showInlineActionBar]Boolean

Whether to show menu actions on this tile's items. Defaults to true. However, actual display of menu depends on toolbarItems configuration and availability of actions against each list item.

[options.toolbarItems]ToolItemsFactory

The menu configuration for this tile's items. Default to Doclist menu configuration. See ToolItemsFactory

[options.applicationScope]string

Name of the application scope perspective which this tile may expand into. The value for this property will be matched against all the registered application scopes. The relevant header button is enabled only if a match is found.

[options.hideOpenPerspective]Boolean

Whether to hide the header button that makes this tile expand into the linked application scope perspective. Defaults to false.

[options.hideSearch]Boolean

Whether to hide the search box from tile header. Defaults to false.

ListTileView~ListTileData : Object

Generic purpose data for the tile. Properties other than icon and title are directly merged with other constructor options.

Kind: inner typedef of ListTileView
Properties

NameTypeDescription
iconstring

CSS class name of the tile header icon

titlestring

Header label for the tile