Page Title Component: Custom Button Actions

A Page Title’s buttons provide the most convenient and straight-forward means for adding arbitrary functionality to a Skuid page. Page Title buttons are typically page-wide in scope. For record detail pages, a Page Title button is often the most appropriate place to surface “actions” related to the record, such as deleting, merging, changing the status or editing, though with the aid of the Action Framework the possibilities are nearly limitless.

If you cannot accomplish your desired functionality using drag-and-drop configuration, Snippets provide an exceptionally flexible way of executing any arbitrary Javascript code. They also provide an excellent way of executing code on the server via Remote Actions (see our article on using custom controllers and extensions with Skuid).

Page Title Button Snippet Reference

A Page Title Button’s associated Action(s) are run when the associated Button is clicked or any defined Hotkeys are pressed, or if “Enter” is pressed when the Button is in focus.

Snippets can be run from Page Title Buttons either by selecting the top-level “Custom: Run Skuid Snippet” Action type, or by selecting “Run Multiple Actions” and adding a child Action of type “Run Skuid JavaScript Snippet.”

This receives a single argument that is a JavaScript object with the following supported properties, depending on which Action Type was used—other properties that may be present on the object are not supported and should not be relied upon as they may change in future releases.

For buttons with a Type of “Custom: Run Skuid Snippet,” the argument will have the following properties:

  • arguments[0].button ($(DOM Element)): a jQuery-wrapped DOM element representing the root HTML node of the button that was clicked.
  • arguments[0].model (skuid.model.Model()): The Model associated with the Page Title component.
  • arguments[0].row (object): The context row in the Page Title’s associated Model, used in rendering the Page Title’s Title and Sub-Title template properties. Typically this will be the first row in the associated Model, but if the Page Title Component has Context Conditions defined on it via the “Context” properties menu, then it will be the first row that matches all of the Context Conditions.

For buttons with a Type of “Run Multiple Actions,” where the Snippet was called using the “Run Skuid JavaScript Snippet” child Action Type, the argument will have the following properties:

  • arguments[0].model (skuid.model.Model()): The Model associated with the Page Title component.
  • arguments[0].row (object): Usually the context row in the Page Title’s associated Model, used in rendering the Page Title’s Title and Sub-Title template properties. Typically this will be the first row in the associated Model, but if the Page Title Component has Context Conditions defined on it via the “Context” properties menu, then it will be the first row that matches all of the Context Conditions. However, if a “Create new row” child Action was used prior to this “Run Skuid JavaScript Snippet” child Action in the overall sequence of Actions, then this row will be the new row created by the “Create new row” Action.