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.
Sorter Extension¶
This extension provides sorting, it also is responsible for passing the “sorter” settings to the view layer.
Settings¶
Sorters setting should be placed under the sorters tree node.
1 datagrids:
2 demo:
3 source:
4 type: orm
5 query:
6 select
7 - o.label
8 - 2 as someAlias
9 - test.some_id as someField
10 from:
11 - { table: SomeBundle:SomeEntity, alias: o }
12 join:
13 left:
14 joinNameOne:
15 join: o.someEntity
16 alias: someEntity
17 joinNameTwo:
18 join: o.testRel
19 alias: test
20 inner:
21 innerJoinName:
22 join: o.abcTestRel
23 alias: abc
24
25 columns:
26 label:
27 type: field
28
29 someColumn:
30 type: fixed
31 value_key: someAlias
32
33 ....
34
35 sorters:
36 toolbar_sorting: true #optional, shows additional sorting control in toolbar
37 columns:
38 label: # column name for view layer
39 data_name: o.label # property in result set (column name or alias), if main entity has alias
40 # like in this example it will be added automatically
41 type: string #optional, affects labels in toolbar sorting
42 someColumn:
43 data_name: someAlias
44 apply_callback: callable # if you want to apply some operations instead of just adding ORDER BY
45 default:
46 label: DESC # sorters enabled by default, key is a column name
47
48 multiple_sorting: true|false # is multisorting mode enabled ? False by default
49
50 disable_default_sorting: true|false # When set to true, no default sorting will be applied
51
52 disable_not_selected_option: true|false(default) # If enabled (true) it will hide `not_selected`
53 (Please select) option from sorting dropdown.
54 Consider enabling it will work only if there is `default` sorting option available and
55 `disable_default_sorting` is not true.
56 In other words `not_selected` will always appear in select dropdown (even if
57 disable_not_selected_option set to true) in such cases:
58 1. If a customer already selected 'not_selected' option earlier.
59 2. If the 'default' option is empty or not defined
60 3. If the 'disable_default_sorting' option is set to true
Note
Customization can be done using the apply_callback options.
Column name should be equal to the name of the corresponding column.