Платформа 3V/Отчет/5. Настроить представление, оформление отчета/Настроить сортировку
Сортировка - это последовательное расположение элементов. Сортировка в отчете реализуется двумя способами:
- Сортировка по столбцу
- Сортировка по справочнику
Исходный справочник:
Сортировка по атрибуту "Наименование":
Сортировка по столбцу
При сортировке по столбцу данные, по которым происходит сортировка, могут являться как значениями атрибутов справочника или показателя, так и быть расчетными
"sortings": [ ] |
---|
1 "view": {
2 ...
3 "sortings": [
4 {
5 "column": 0,
6 "sortDirection": "Descending",
7 "nullsSortingMode": "PlaceLast",
8 "discriminator": "PivotColumnSortingDto"
9 }
10 ]
11 ...
12 }
|
Параметр | Описание |
---|---|
"column": 0 | нумерация столбцов начинается с 0 |
"sortDirection": "Descending" / Ascending | по убыванию / по возрастанию |
"nullsSortingMode": "PlaceFirst" / "PlaceLast", | нулевые в начале / нулевые в конце |
Пример использования
Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице Сортировка элементов справочника (SortingOptions)
1 {
2 "workflowId": null,
3 "leftHeader": {
4 "useLazyDataLoadingStrategy": false,
5 "dictionaries": [
6 {
7 "showDataIfAbsentFilter": null,
8 "coordAttribute": null,
9 "cartesianOptions": "Default",
10 "canSelectAttribute": null,
11 "groupingOptions": null,
12 "groupingMethod": "Default",
13 "sortingOptions": null,
14 "rootElement": null,
15 "virtualElements": null,
16 "displayValueOptions": null,
17 "displayAttribute": null,
18 "dictionaryId": 84,
19 "filter": {
20 "value": null,
21 "skipIfValueNull": false,
22 "attributeId": null,
23 "attribute": {
24 "id": 1,
25 "discriminator": "OwnAttributeDefinitionDto"
26 },
27 "conditionType": "AllElements",
28 "inversion": false,
29 "discriminator": "ValueConditionalDictionaryFilterDto"
30 },
31 "selection": null,
32 "hierarchyId": null,
33 "limit": null
34 }
35 ],
36 "dictionaryAttributesLinks": [],
37 "specialFilters": {
38 "filtersByDataOptions": {
39 "filtersByData": [],
40 "needRestoreFullHierachy": false,
41 "joinOption": "Or",
42 "restoreElements": null
43 },
44 "dictionaryAttributesLinks": [],
45 "needRestoreFullHierachy": false,
46 "restoreElements": null
47 },
48 "isEditable": false
49 },
50 "topHeader": {
51 "topHeaderItems": [
52 {
53 "dictionaryAttributes": [
54 {
55 "dictionaryId": 84,
56 "attribute": {
57 "id": 2,
58 "discriminator": "OwnAttributeDefinitionDto"
59 },
60 "filter": null,
61 "sortingOptions": null,
62 "attributeId": null,
63 "displayAttributeType": "AttributeName",
64 "displayAttributeName": null,
65 "addFirstElementValue": false,
66 "overwriteNotFirstElementValues": true,
67 "delimiter": ", ",
68 "hideAttributeNameInHeader": false,
69 "headerNameDelimiter": " / ",
70 "duplicateValuesForNextDictionaries": true,
71 "duplicateValuesForNextRows": true,
72 "displayValueOptions": null,
73 "linkedAttributeSettings": null,
74 "skippedFilterAttributesByLink": [],
75 "filterOptionsByLinks": null
76 }
77 ],
78 "settings": null,
79 "hyperlinkOptions": null,
80 "hasImage": false,
81 "columnOptions": null,
82 "discriminator": "AttributeHeaderItemDto"
83 },
84 {
85 "dictionaryAttributes": [
86 {
87 "dictionaryId": 84,
88 "attribute": {
89 "id": 21,
90 "discriminator": "OwnAttributeDefinitionDto"
91 },
92 "filter": null,
93 "sortingOptions": null,
94 "attributeId": null,
95 "displayAttributeType": "AttributeName",
96 "displayAttributeName": null,
97 "addFirstElementValue": false,
98 "overwriteNotFirstElementValues": true,
99 "delimiter": ", ",
100 "hideAttributeNameInHeader": false,
101 "headerNameDelimiter": " / ",
102 "duplicateValuesForNextDictionaries": true,
103 "duplicateValuesForNextRows": true,
104 "displayValueOptions": null,
105 "linkedAttributeSettings": null,
106 "skippedFilterAttributesByLink": [],
107 "filterOptionsByLinks": null
108 }
109 ],
110 "settings": null,
111 "hyperlinkOptions": null,
112 "hasImage": false,
113 "columnOptions": null,
114 "discriminator": "AttributeHeaderItemDto"
115 },
116 {
117 "dictionaryAttributes": [
118 {
119 "dictionaryId": 84,
120 "attribute": {
121 "id": 22,
122 "discriminator": "OwnAttributeDefinitionDto"
123 },
124 "filter": null,
125 "sortingOptions": null,
126 "attributeId": null,
127 "displayAttributeType": "AttributeName",
128 "displayAttributeName": null,
129 "addFirstElementValue": false,
130 "overwriteNotFirstElementValues": true,
131 "delimiter": ", ",
132 "hideAttributeNameInHeader": false,
133 "headerNameDelimiter": " / ",
134 "duplicateValuesForNextDictionaries": true,
135 "duplicateValuesForNextRows": true,
136 "displayValueOptions": null,
137 "linkedAttributeSettings": null,
138 "skippedFilterAttributesByLink": [],
139 "filterOptionsByLinks": null
140 }
141 ],
142 "settings": null,
143 "hyperlinkOptions": null,
144 "hasImage": false,
145 "columnOptions": null,
146 "discriminator": "AttributeHeaderItemDto"
147 },
148 {
149 "dictionaryAttributes": [
150 {
151 "dictionaryId": 84,
152 "attribute": {
153 "id": 23,
154 "discriminator": "OwnAttributeDefinitionDto"
155 },
156 "filter": null,
157 "sortingOptions": null,
158 "attributeId": null,
159 "displayAttributeType": "AttributeName",
160 "displayAttributeName": null,
161 "addFirstElementValue": false,
162 "overwriteNotFirstElementValues": true,
163 "delimiter": ", ",
164 "hideAttributeNameInHeader": false,
165 "headerNameDelimiter": " / ",
166 "duplicateValuesForNextDictionaries": true,
167 "duplicateValuesForNextRows": true,
168 "displayValueOptions": null,
169 "linkedAttributeSettings": null,
170 "skippedFilterAttributesByLink": [],
171 "filterOptionsByLinks": null
172 }
173 ],
174 "settings": null,
175 "hyperlinkOptions": null,
176 "hasImage": false,
177 "columnOptions": null,
178 "discriminator": "AttributeHeaderItemDto"
179 }
180 ],
181 "needFilterAttributesByLinks": false,
182 "enableFilterByLinks": false,
183 "numerationSettings": null,
184 "filterOptions": null
185 },
186 "parameters": [],
187 "styles": [],
188 "styleOptions": [],
189 "stylesTemplate": [],
190 "filtersByDataOptions": null,
191 "view": {
192 "isTopHeaderHidden": false,
193 "areRowsColumnsNamesHidden": false,
194 "transposeOptions": null,
195 "isStylesTemplateEnabled": false,
196 "topHeaderStyleId": null,
197 "leftHeaderExpandedLevel": 2,
198 "fixedColumn": null,
199 "pagingOptions": null,
200 "emptyValueDisplayString": null,
201 "disabledEvents": null,
202 "disableVirtualScroll": false,
203 "defaultRowPixelHeight": null,
204 "gridComponent": null,
205 "disableRefreshWhenParameterChanged": false,
206 "maxRowsCount": null,
207 "sortings": [
208 {
209 "column": 0,
210 "sortDirection": "Descending",
211 "nullsSortingMode": "PlaceLast",
212 "discriminator": "PivotColumnSortingDto"
213 }
214 ],
215 "buttons": null,
216 "filters": null,
217 "isReadOnly": false,
218 "leftHeaderElementsCount": null
219 },
220 "externalExecutions": null,
221 "settings": null,
222 "code": "P_Сортировка по столбцу",
223 "id": 86,
224 "name": "Сортировка по столбцу"
225 }
Сортировка по справочнику
Основным отличием от сортировки по столбцу является то, что сортировка может производится только по определенным атрибутам справочника, находящегося в строках отчета.
"sortingOptions": [ ] |
---|
1 "sortingOptions": {
2 "attributes": [
3 {
4 "attribute": {
5 "id": 1,
6 "discriminator": "OwnAttributeDefinitionDto"
7 },
8 "sortDirection": "Descending",
9 "nullsSortingMode": "PlaceFirst"
10 }
11 ]
12 }
|
Значение | Описание |
---|---|
attribute | описание пути до атрибута, по которому будет производиться сортировка |
sortDirection | Направление по убыванию / по возрастанию ("Descending" / "Ascending") |
nullsSortingMode | нулевые значения в начале / в конце ("PlaceFirst" / "PlaceLast") |
Пример использования
Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице Сортировка элементов справочника (SortingOptions)
1 {
2 "workflowId": null,
3 "leftHeader": {
4 "useLazyDataLoadingStrategy": false,
5 "dictionaries": [
6 {
7 "showDataIfAbsentFilter": null,
8 "coordAttribute": null,
9 "cartesianOptions": "Default",
10 "canSelectAttribute": null,
11 "groupingOptions": null,
12 "groupingMethod": "Default",
13 "sortingOptions": {
14 "attributes": [
15 {
16 "attribute": {
17 "id": 2,
18 "discriminator": "OwnAttributeDefinitionDto"
19 },
20 "sortDirection": "Ascending",
21 "nullsSortingMode": "PlaceFirst"
22 }
23 ]
24 },
25 "rootElement": null,
26 "virtualElements": null,
27 "displayValueOptions": null,
28 "displayAttribute": null,
29 "dictionaryId": 84,
30 "filter": {
31 "value": null,
32 "skipIfValueNull": false,
33 "attributeId": null,
34 "attribute": {
35 "id": 1,
36 "discriminator": "OwnAttributeDefinitionDto"
37 },
38 "conditionType": "AllElements",
39 "inversion": false,
40 "discriminator": "ValueConditionalDictionaryFilterDto"
41 },
42 "selection": null,
43 "hierarchyId": null,
44 "limit": null
45 }
46 ],
47 "dictionaryAttributesLinks": [],
48 "specialFilters": {
49 "filtersByDataOptions": {
50 "filtersByData": [],
51 "needRestoreFullHierachy": false,
52 "joinOption": "Or",
53 "restoreElements": null
54 },
55 "dictionaryAttributesLinks": [],
56 "needRestoreFullHierachy": false,
57 "restoreElements": null
58 },
59 "isEditable": false
60 },
61 "topHeader": {
62 "topHeaderItems": [
63 {
64 "dictionaryAttributes": [
65 {
66 "dictionaryId": 84,
67 "attribute": {
68 "id": 2,
69 "discriminator": "OwnAttributeDefinitionDto"
70 },
71 "filter": null,
72 "sortingOptions": null,
73 "attributeId": null,
74 "displayAttributeType": "AttributeName",
75 "displayAttributeName": null,
76 "addFirstElementValue": false,
77 "overwriteNotFirstElementValues": true,
78 "delimiter": ", ",
79 "hideAttributeNameInHeader": false,
80 "headerNameDelimiter": " / ",
81 "duplicateValuesForNextDictionaries": true,
82 "duplicateValuesForNextRows": true,
83 "displayValueOptions": null,
84 "linkedAttributeSettings": null,
85 "skippedFilterAttributesByLink": [],
86 "filterOptionsByLinks": null
87 }
88 ],
89 "settings": null,
90 "hyperlinkOptions": null,
91 "hasImage": false,
92 "columnOptions": null,
93 "discriminator": "AttributeHeaderItemDto"
94 },
95 {
96 "dictionaryAttributes": [
97 {
98 "dictionaryId": 84,
99 "attribute": {
100 "id": 21,
101 "discriminator": "OwnAttributeDefinitionDto"
102 },
103 "filter": null,
104 "sortingOptions": null,
105 "attributeId": null,
106 "displayAttributeType": "AttributeName",
107 "displayAttributeName": null,
108 "addFirstElementValue": false,
109 "overwriteNotFirstElementValues": true,
110 "delimiter": ", ",
111 "hideAttributeNameInHeader": false,
112 "headerNameDelimiter": " / ",
113 "duplicateValuesForNextDictionaries": true,
114 "duplicateValuesForNextRows": true,
115 "displayValueOptions": null,
116 "linkedAttributeSettings": null,
117 "skippedFilterAttributesByLink": [],
118 "filterOptionsByLinks": null
119 }
120 ],
121 "settings": null,
122 "hyperlinkOptions": null,
123 "hasImage": false,
124 "columnOptions": null,
125 "discriminator": "AttributeHeaderItemDto"
126 },
127 {
128 "dictionaryAttributes": [
129 {
130 "dictionaryId": 84,
131 "attribute": {
132 "id": 22,
133 "discriminator": "OwnAttributeDefinitionDto"
134 },
135 "filter": null,
136 "sortingOptions": null,
137 "attributeId": null,
138 "displayAttributeType": "AttributeName",
139 "displayAttributeName": null,
140 "addFirstElementValue": false,
141 "overwriteNotFirstElementValues": true,
142 "delimiter": ", ",
143 "hideAttributeNameInHeader": false,
144 "headerNameDelimiter": " / ",
145 "duplicateValuesForNextDictionaries": true,
146 "duplicateValuesForNextRows": true,
147 "displayValueOptions": null,
148 "linkedAttributeSettings": null,
149 "skippedFilterAttributesByLink": [],
150 "filterOptionsByLinks": null
151 }
152 ],
153 "settings": null,
154 "hyperlinkOptions": null,
155 "hasImage": false,
156 "columnOptions": null,
157 "discriminator": "AttributeHeaderItemDto"
158 },
159 {
160 "dictionaryAttributes": [
161 {
162 "dictionaryId": 84,
163 "attribute": {
164 "id": 23,
165 "discriminator": "OwnAttributeDefinitionDto"
166 },
167 "filter": null,
168 "sortingOptions": null,
169 "attributeId": null,
170 "displayAttributeType": "AttributeName",
171 "displayAttributeName": null,
172 "addFirstElementValue": false,
173 "overwriteNotFirstElementValues": true,
174 "delimiter": ", ",
175 "hideAttributeNameInHeader": false,
176 "headerNameDelimiter": " / ",
177 "duplicateValuesForNextDictionaries": true,
178 "duplicateValuesForNextRows": true,
179 "displayValueOptions": null,
180 "linkedAttributeSettings": null,
181 "skippedFilterAttributesByLink": [],
182 "filterOptionsByLinks": null
183 }
184 ],
185 "settings": null,
186 "hyperlinkOptions": null,
187 "hasImage": false,
188 "columnOptions": null,
189 "discriminator": "AttributeHeaderItemDto"
190 }
191 ],
192 "needFilterAttributesByLinks": false,
193 "enableFilterByLinks": false,
194 "numerationSettings": null,
195 "filterOptions": null
196 },
197 "parameters": [],
198 "styles": [],
199 "styleOptions": [],
200 "stylesTemplate": [],
201 "filtersByDataOptions": null,
202 "view": null,
203 "externalExecutions": null,
204 "settings": null,
205 "code": "P_Сортировка по справочнику ",
206 "id": 83,
207 "name": "Сортировка по справочнику"
208 }