Module: alfresco/renderers/Reorder

alfresco/renderers/Reorder

This renderer was originally written for the faceted search configuration page. It provides the ability to render up and down arrows for each item in a list and performs publications when those arrows are clicked (or actioned by the keyboard).

The propertyToRender attribute is used for alt-text and title messages that attempt to create meaningful messages for visually impaired users so it should be set accordingly - e.g. to the identifier of the item being rendered. The message itself can be overridden by modifying the upAltText and downAltText attributes.

The default up and down arrow images can be overridden by modifying the upArrowImg and downArrowImg attributes.

Example model configuration:

name: "alfresco/renderers/Reorder",
config: {
   propertyToRender: "displayName",
   moveUpPublishTopic: "",
   moveUpPublishPayloadType: "PROCESS",
   moveUpPublishPayloadModifiers: ["processCurrentItemTokens"],
   moveUpPublishPayloadItemMixin: true,
   moveUpPublishPayload: {
      url: "api/solr/facet-config/{filterID}?relativePos=-1"
   },
   moveDownPublishTopic: "ALF_CRUD_UPDATE",
   moveDownPublishPayloadType: "PROCESS",
   moveDownPublishPayloadModifiers: ["processCurrentItemTokens"],
   moveDownPublishPayloadItemMixin: true,
   moveDownPublishPayload: {
      url: "api/solr/facet-config/{filterID}?relativePos=1"
  }
}

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/Reorder.css"}]
Source:

downAltText :string

This is the message or message key that will be used for the alt text attribute on the up arrow
Type:
  • string
Default Value:
  • "reorder.movedown.altText"
Source:

downArrowImg :string

This is the file name of the image to use for the icon that when clicked will move the rendered item higher in the current order.
Type:
  • string
Default Value:
  • "move-down.png"
Source:

downPublishTopic :string

This defines the topic that will be published on when the up icon is clicked. The payload will be the "currentItem" attribute.
Type:
  • string
Default Value:
  • "ALF_REORDER_DOWN"
Source:

i18nRequirements :object

The array of file(s) containing internationalised strings.
Type:
  • object
Default Value:
  • [{i18nFile: "./i18n/Reorder.properties"}]
Source:

propertyToRender :string

This is the property of the current item to embed in the alt text and title of the up and down arrows. It is important for accessibility reasons that the arrow alt-text contains useful information about which item is to be moved.
Type:
  • string
Default Value:
  • "displayName"
Source:

templateString :string

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

upAltText :string

This is the message or message key that will be used for the alt text attribute on the up arrow
Type:
  • string
Default Value:
  • "reorder.moveup.altText"
Source:

upArrowImg :string

This is the file name of the image to use for the icon that when clicked will move the rendered item higher in the current order.
Type:
  • string
Default Value:
  • "move-up.png"
Source:

upPublishTopic :string

This defines the topic that will be published on when the up icon is clicked. The payload will be the "currentItem" attribute.
Type:
  • string
Default Value:
  • "ALF_REORDER_UP"
Source:

Methods

onDownClick(evt)

Publishes a payload for moving the current item down a place. The payload is generated by calling the generatePayload function using the "moveDownPublishPayload", "moveDownPublishPayloadType", "moveDownPublishPayloadItemMixin" and "moveDownPublishPayloadModifiers" attributes.
Parameters:
Name Type Description
evt object The click event object
Source:

onUpClick(evt)

Publishes a payload for moving the current item up a place. The payload is generated by calling the generatePayload function using the "moveUpPublishPayload", "moveUpPublishPayloadType", "moveUpPublishPayloadItemMixin" and "moveUpPublishPayloadModifiers" attributes.
Parameters:
Name Type Description
evt object The click event object
Source:

postCreate()

Checks that the current item has an index attribute and checks the index to determine whether or not the up or down arrow should be hidden.
Source:

postMixInProperties()

Set up the attributes to be used when rendering the template.
Source: