Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Action Extension

This extension is responsible for configuring actions for the datagrid. Developers can easilt add action types. The configuration for actions should be placed under the actions node.

Actions

type is a required option for the action configuration. Action access can be controlled by adding the acl_resource node to each action (this parameter is optional).

Ajax

Performs ajax call by the given URL.

1 action_name:
2     type: ajax
3     link: PROPERTY_WITH_URL # required

Delete

Performs DELETE ajax request by the given URL.

1 action_name:
2     type: delete
3     link: PROPERTY_WITH_URL  # required
4     confirmation: true|false # should confirmation window be shown

Import

Performs import of an entity.

 1 action_name:
 2     type: import
 3     entity_class: 'Acme\Bundle\DemoBundle\Entity\TestEntity'
 4     importProcessor: 'acme_import_processor' # required
 5     importJob: 'acme_import_from_csv'
 6     options:
 7         refreshPageOnSuccess: false # refresh page after success
 8         importTitle: Custom Import Title
 9         datagridName: 'acme-entity-grid' # refresh datagrid after success
10         routeOptions:
11             param1: value1

Export

Performs export of an entity.

1 action_name:
2     type: import
3     entity_class: 'Acme\Bundle\DemoBundle\Entity\TestEntity'
4     exportProcessor: 'acme_export_processor' # required
5     exportJob: 'acme_export_to_csv'
6     filePrefix: 'test-entity-prefix'
7     options:
8         routeOptions:
9             param1: value1

Row Click

To configure an action that executes on row click, set the rowAction param to true.

Control Actions on Record Level and Custom Configuration

To manage(show/hide) some actions by condition(dependent on row), add the action_configuration option to the datagrid configuration. This option should contain array or closure. Closure should return an array of actions that must be shown/hidden. The key of the array should be an action name and value should be true(or array)/false value (show/hide respectively). This configuration will be passed to the JavaScript component.

1 # static configuration
2 action_configuration:
3     action1: false # hidden
4     action2: true # shown
5     action3: {param1: 'value1'} # shown and pass {param1: 'value1'} to component
1 # dynamic configuration
2 action_configuration: ['@acme.datagrid.action_configuration_provider', 'getActionConfiguration']