Module: alfresco/lists/AlfHashList

alfresco/lists/AlfHashList

This extends the basic list to provide support for reloading data based on relevant changes to the browser URL hash. The hash parameters that are relevant (i.e. that when changed should cause the data to be reloaded) should be defined in the hashVarsForUpdate attribute.
Author:
  • Dave Draper
License:
Source:

Members

___filtersRemoved :number

This is used to keep track of any filters that are removed from the URL hash. It is reset in each call to onFiltersUpdated and then incremented each time a filter is removed (because it has become the empty string). This is then referenced in the onHashChange in order to determine whether or not data reloading needs to occur as a result of filter removal.
Type:
  • number
Since:
  • 1.0.34
Default Value:
  • 0
Source:

hashVarsForUpdate :array

An array of hash variables that when changed will trigger a reload
Type:
  • array
Default Value:
  • []
Source:

mapHashVarsToPayload :boolean

Indicates whether or not the hashVarsForUpdate that are present in the current hash should be mapped directly into the loadDataPublishPayload.
Type:
  • boolean
Default Value:
  • false
Source:

updateInstanceValues :boolean

Indicates whether or not changing URL hash parameters should be set as instance variables on the list.
Type:
  • boolean
Default Value:
  • false
Source:

useHash :boolean

Indicates whether the location should be driven by changes to the browser URL hash
Type:
  • boolean
Default Value:
  • false
Source:

useLocalStorageHashFallback :boolean

Determines whether or not a locally stored hash value should be maintained and re-used in the event of a hash not being found in the URL. This was added to support the scenario where a user might leave and then return to a page having lost the hash (e.g. actions on search).
Type:
  • boolean
Default Value:
  • false
Source:

useLocalStorageHashFallbackKey :string

The key to use for storing the hash when the useLocalStorageHashFallback is set to true.
Type:
  • string
Default Value:
  • "ALF_LOCAL_STORAGE_HASH"
Source:

Methods

_updateCoreHashVars(hashParameters)

This is an extension point function that is provided to allow core URL hash parameters to be addressed when the URL hash change triggers a reload. For example this allows the AlfSortablePaginatedList to address hash parameters relating to sorting and pagination and the AlfDocumentList to further address hash parameters relating to filtering.
Parameters:
Name Type Description
hashParameters object An object containing the current hash parameters
Source:

onFiltersUpdated()

Handle filters being updated
Source:

onHashChanged(payload) → {bool}

This function is called whenever the browser URL hash fragment is changed.e end of the fragment
Parameters:
Name Type Description
payload object
Source:
Returns:
true if data was loaded as a result of the hash-change
Type
bool

onPageWidgetsReady(payload)

The AlfHashList is intended to work co-operatively with other widgets on a page to assist with setting the data that should be retrieved. As related widgets are created and publish their initial state they may trigger requests to load data. As such, data loading should not be started until all the widgets on the page are ready. This function extends the inherited function to honour the useHash configuration and load data appropriately.
Parameters:
Name Type Description
payload object
Source:

postCreate()

Extends the inherited function to ensure that all views have access to the useHash configuration. This is important because it may be necessary for them to update child widgets to reflect hash data in some way (this has been specifically added to address the issue of sort indication rendered by HeaderCells).
Since:
  • 1.0.56
Source:

showView(payload)

Extends the inherited function to check whether or not a URL hash parameter is set to indicate a particular item to bring into view. This URL hash parameter checked is the "currentItem" and if this is found it will publish the value on the "ALF_BRING_ITEM_INTO_VIEW" topic.
Parameters:
Name Type Description
payload object The payload containing the loaded data.
Since:
  • 1.0.101
Source:
Fires:

updateLoadDataPayload(payload)

Extends the inherited function to map the hashVarsForUpdate values into the loadDataPublishPayload if mapHashVarsToPayload is set to true.
Parameters:
Name Type Description
payload object The payload to update
Source:

updateLocallyStoredHash(payload)

Sets the current hash in the local storage.
Parameters:
Name Type Description
payload object
Source: