action

Overview

With the use of a nested action in an edit-typeahead an additional item will appear with the results of on-search. If this item is selected, this action tag's on-press will fire with the current search value.

Basic Example

In this example we add the option to create a new user.

main.view.xml
<object-table ...>
  <column ...>
    <edit-typeahead ...>
      <action label="Create User" icon="fa-user" on-press="$:createUser($object, searchValue)" />
    </edit-typeahead>
  </column>
</object-table>
main.js
function createUser(object, searchValue){
    var user = DB.user.create();
    user.name = searchValue;
    user.save();
}

Standard Attributes

label

Optional

Type: string (static text, a format string or the return value of a JS/TS function)

Default: unset

The text to display on the action item.

on-press

Required

pageon-press

validate

Optional

Type: boolean

Default: false

Set to true to ensure that no required input fields in the current view are empty before performing the on-press action.

<action on-press="$:createUser($object, searchValue)" validate="true" />

Advanced Attributes

icon

Optional

Type: string

Default: fa-circle-plus

The icon to display on the button, it will be placed on the left of the label by default. The icon can be a Font Awesome icon or an Ionicons icon.

<action icon="fa-user" on-press="$:createUser($object, searchValue)" />

Last updated