Module: alfresco/lists/views/AlfListView

alfresco/lists/views/AlfListView

An abstract view for the Alfresco Share document list. It can be used in JSON page models if configured with a widgets definition. Otherwise it can be extended to define specific views
Author:
  • Dave Draper
License:
Source:

Members

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/AlfListView.css"}]
Source:

documentSubscriptionTopic :string

This is the topic that will be subscribed to when [subscribeToDocRequests] module:alfresco/lists/views/AlfListView#subscribeToDocRequests is configured to be true.
Type:
  • string
Default Value:
  • "ALF_RETRIEVE_DOCUMENTS_REQUEST_SUCCESS"
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/AlfListView.properties"}]
Source:

itemKey :string

This is the property of each item in the list that uniquely identifies that item. This should be configured correctly in order for items to be brought into view as required.
Type:
  • string
Default Value:
  • "nodeRef"
Source:

itemsProperty :string

This is the property that is used to lookup documents in the subscribed topic.
Type:
  • string
Default Value:
  • "response.items"
Source:

minHeight :Number|String

Minimum height for this view. Not used by default. Can be either a Number (treated as pixels) or a String (treated as CSS units).
Type:
  • Number | String
Since:
  • 1.0.67
Default Value:
  • null
Source:

noItemsMessage :string

This can be set to be a custom message that is displayed when there are no items to be displayed in the current view. This will not be used if widgetsForNoDataDisplay is configured.
Type:
  • string
Default Value:
  • null
Source:

renderFilterSelectorQuery :string

This is the default CSS selector query to use to check whether any data has actually been rendered. It's used from within the renderView function to check that data is actually rendered (because even though renderable items might exist it's possible for them to be filtered out so that they're not displayed). This needs to be overriden by views that don't render a DOM that matches the query.
Type:
  • string
Default Value:
  • "tr"
Source:

subscribeToDocRequests :Boolean

Should the widget subscribe to events triggered by the documents request? This should be set to true in the widget config for standalone/isolated usage.
Type:
  • Boolean
Default Value:
  • false
Source:

suppressDndUploading :boolean

Overrides the inherited default configuration to suppress the drag-and-drop upload highlighting.
Type:
  • boolean
Since:
  • 1.0.39
Default Value:
  • true
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

useHash :boolean

This will be automatically set when the view is used in an AlfHashList. It indicates whether or not the list is being driven by data set on the browser URL hash and it can be useful for views to have access to this information.
Type:
  • boolean
Since:
  • 1.0.56
Default Value:
  • null
Source:

useInfiniteScroll :boolean

Whether the list that's creating this view has infinite scroll turned on
Type:
  • boolean
Since:
  • 1.0.32
Default Value:
  • false
Source:

viewSelectionConfig :Object

The configuration for view selection menu items. This needs to be either configured or defined in an extending module. If this isn't specified then the view will not be selectable in the document list.
Type:
  • Object
Default Value:
  • {}
Source:

widgets :object[]

The widgets to be processed to generate each item in the rendered view.
Type:
  • object[]
Default Value:
  • null
Source:

widgetsForAppendix :object[]

An optional widget model to be rendered as an appendix to the actual data. If this is defined then it will never be possible for the widgetsForNoDataDisplay model to be rendered because it results in a special marker being added to the data set to be rendered.
Type:
  • object[]
Since:
  • 1.0.44
Default Value:
  • null
Source:

widgetsForNoDataDisplay :array

An optional JSON model defining the widgets to display when no data is available to display.
Type:
  • array
Default Value:
  • null
Source:

Methods

_renderCaption()

Optionally add a caption to the generated table
Source:

_renderHeader()

Optionally builds the header contents from a nested set of widgets in attribute widgetsForHeader
Source:

_renderOptionalElements()

Runs _renderHeader() and _renderCaption() in the correct order to construct the elements appropriately
Source:

augmentData(newData)

Extends the inherited function to also update the docListRenderer if it exists with the data.
Parameters:
Name Type Description
newData object The additional data to add.
Source:

clearOldView()

Removes the previously rendered view.
Source:

createListRenderer() → {object}

Creates a new ListRenderer which is used to render the actual items in the view. This function can be overridden by extending views (such as the Film Strip View) to create alternative widgets applicable to that view.
Source:
Returns:
A new ListRenderer
Type
object

destroyRenderer()

This should be called when the renderers need to be removed.
Since:
  • 1.0.32
Support:
  • This function is safe to be overridden by extending or mixing modules (at least until the next major release). The inherited code must be called in the overriding function and if the inherited function returns a value then that value must be returned by the overriding function.
Source:

destroyWidget(widget, index)

Called from renderView for every widget created for the last view. It is important that widgets are properly destroyed to ensure that they do not respond to topics that they have subscribed to (e.g. selection events such as selecting all documents).
Parameters:
Name Type Description
widget object The widget to destroy
index number The index of the widget
Source:

focusOnItem(itemKey)

This can be called to focus on a specific item in the view. The itemKey provided must match the value of the itemKey property of an item in the rendered data.
Parameters:
Name Type Description
itemKey string The key of the item to focus on.
Since:
  • 1.0.77
Source:

getAdditionalControls() → {Object[]}

This function should be overridden to publish the details of any additional controls that are needed to control view of the data that it provides. An example of a control would be the thumbnail size slider for the gallery control.
Source:
Returns:
Type
Object[]

getViewName() → {string}

This should be overridden to give each view a name. If it's not overridden then the view will just get given a name of the index that it was registered with. It will still be possible to select the view but it will cause issues with preferences.
Source:
Returns:
"Abstract"
Type
string

getViewSelectionConfig() → {Object}

This should be overridden to provide configuration for view selection. As a minimum, a localised label MUST be provided as the "label" attribute. Other attributes that could be provided would be "iconClass". This configuration will typically be used to construct a menu item. By default this just returns the viewSelectionConfig
Source:
Returns:
The configuration for selecting the view.
Type
Object

onDocumentsLoaded(payload)

Parameters:
Name Type Description
payload object The details of the documents that have been provided.
Source:

onViewNameRequest(payload)

If the supplied payload contains a view value that matches this view then this will resolve the promise that should be included.
Parameters:
Name Type Description
payload object A payload containing a view value and a promise to resolve.
Source:

onViewShown()

Called after the view has been shown (note that renderView does not mean that the view has been displayed, just that it has been rendered.
Source:

postCreate()

Implements the widget life-cycle method to add drag-and-drop upload capabilities to the root DOM node. This allows files to be dragged and dropped from the operating system directly into the browser and uploaded to the location represented by the document list.
Source:

processItem(item, index)

Attempts to process an item provided to the onDocumentsLoaded function. By default this attempts to process node data as the default behaviour is to assume this is an Alfresco node.
Parameters:
Name Type Description
item object The item to process
index number The index of the item
Source:

renderErrorDisplay()

This method is called when there is an error occurred rendering the view
Source:

renderNoDataDisplay()

This method is called when there is no data to be shown. By default this just shows a standard localized message to say that there is no data.
Source:

renderView(preserveCurrentData)

Calls the renderData function if the currentData attribute has been set to an object with an "items" attribute that is an array of objects.
Parameters:
Name Type Description
preserveCurrentData boolean This should be set to true when you don't want to clear the old data, the most common example of this is when infinite scroll is being used.
Source: