Skip to content

Option

An option is an action that can be executed by the user. It can be a link to another view, a command executed on the server, or a link to an external resource.

Attributes

All attributes are optional.

  • name - name of the option; default d + position
  • title - title associated with the name
  • label - label of the option
  • element value (text or CDATA) - URL or command to be executed when the option is selected
    • server-side variables [[variable]] are available; see server-side variables
    • client-side parameters are available as {parameter}, replaced in order of priority:
      1. client-side parameters passed to the SRS
      2. query string parameters
  • acl - permission required for the option
  • css - CSS class for styling
  • scope - limits the option to a command in the user interface; comma-separated values are allowed, for example scope="orders,items"; an option scoped to a command that is not in the result is removed
  • opts - extra options that modify the behavior of the option on the client side
    • uimenu - for a v_ type: renders the component directly in the options bar instead of a button that opens a side modal
  • type - default (empty): a plain link to the URL
    • pa_post - sends one POST request per selected row (row object as the body); requires opts="uiclipboard" on the command
    • pa_post_many - sends one POST request with an array of the selected rows; several URLs separated by | are called one after another
    • pa_post_clipboard - sends one POST request with the current parameters and the selected rows in the clipboard property; when the URL contains filename=, the response is downloaded as a file with that name
    • pa_post_single - sends one POST request with the current parameters, then reloads the SRS
    • pa_post_blank - sends a POST request without a body, then reloads the SRS
    • pa_blink - opens an external link in a new window
    • pa_elink - opens an external link in the same browser tab, replacing the current content
    • pa_mlink - opens a modal dialog within the application; typically used to display content or perform actions without navigating away from the current view
    • pa_download - downloads a file from an external link; the download starts automatically without user interaction
    • pa_info - displays a simple message; a value is required
    • v_(Name_of_the_component) - opens the specified Vue component in a side modal; the type name must start with the v_ prefix; see Display a custom component

Examples

XML
1
2
3
4
5
6
7
8
9
<itm model="option" label="Show all" css="xd-success" scope="orders">
  <![CDATA[/srs/301-all orders/view?firmid={firmid}&amp;date_to=&amp;]]>
</itm>
<itm model="option" css="xd-success" label="Remove Selected" scope="documenttypes"  type="pa_post">
  <![CDATA[/api/srs/delete]]>
</itm>
<itm model="option" label="Create account" css="xd-success"   type="pa_elink" >
  <![CDATA[/pages/crm/account]]>
</itm>

pa_post

Type pa_post requires opts="uiclipboard" on the command.

XML
<itm model="option" label="Zapisz" type="pa_post">/api/srs/506-api-nest-set/run</itm>
XML
1
2
3
4
5
6
7
8
9
<srs>
  <def>
    <itm>
      <![CDATA[
        update table set x= @column1 where y=@column2
        ]]>
    </itm>
  </def>
</srs>

These types are used to open links in different ways.

  • URL can be a relative or absolute path.
  • Server-side variables [[variable]] are available; see server-side variables.
  • Client-side parameters are available as {parameter}, replaced in order of priority:
    1. client-side parameters passed to the SRS
    2. query string parameters
XML
1
2
3
<itm model="option" type="pa_mlink" css="xd-blue0" scope="items" name="comparestock"  label="Compare stock" >
  <![CDATA[/srs/419-compare/view?remoteSource=invoice&remoteID={invoiceid}]]>
</itm>

Display a custom component

The type attribute must start with the v_ prefix and contain the name of the component.

  • the element value is an optional JSON object with component props; it is passed to the component as the params prop (with opts="uimenu", the keys are also bound as props)
  • the component also receives parameters (SRS def), table, option and clipboard_items; a reload-event emitted by the component reloads the table
XML
1
2
3
4
5
6
7
8
<srs label="Hello World">
  <def>
    <itm model="option" label="Report time, resources" type="v_timesheet" />
    <itm model="option" label="Test auto form" type="v_form_auto">
      <![CDATA[ { "srsurl":"srs/715" } ]]>
    </itm>
  </def>
</srs>

See v_form_auto.