Платформа 3V/Отчет/5. Настроить представление, оформление отчета/Настроить сортировку: различия между версиями
Строка 1: | Строка 1: | ||
+ | __NOTOC__ | ||
+ | Сортировка - это последовательное расположение элементов. Сортировка в отчете реализуется двумя способами: | ||
+ | # Сортировка по столбцу | ||
+ | # Сортировка по справочнику | ||
+ | Исходный справочник: | ||
+ | [[Файл:без сортировки.jpg|500px|безрамки|без]] | ||
+ | <br> | ||
+ | Сортировка по атрибуту "Наименование": | ||
+ | [[Файл:Сортировка в отчете.jpg|500px|безрамки|без]] | ||
== Сортировка по столбцу == | == Сортировка по столбцу == | ||
+ | При сортировке по столбцу данные, по которым происходит сортировка, могут являться как значениями атрибутов справочника или показателя, так и быть расчетными | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Строка 6: | Строка 16: | ||
|- | |- | ||
| <syntaxhighlight lang="JSON" line> | | <syntaxhighlight lang="JSON" line> | ||
− | { | + | "view": { |
− | "column": | + | ... |
+ | "sortings": [ | ||
+ | { | ||
+ | "column": 0, | ||
"sortDirection": "Descending", | "sortDirection": "Descending", | ||
"nullsSortingMode": "PlaceLast", | "nullsSortingMode": "PlaceLast", | ||
"discriminator": "PivotColumnSortingDto" | "discriminator": "PivotColumnSortingDto" | ||
} | } | ||
+ | ] | ||
+ | ... | ||
+ | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
Строка 25: | Строка 41: | ||
| "nullsSortingMode": "PlaceFirst" / "PlaceLast",|| нулевые в начале / нулевые в конце | | "nullsSortingMode": "PlaceFirst" / "PlaceLast",|| нулевые в начале / нулевые в конце | ||
|} | |} | ||
+ | |||
+ | === Пример использования=== | ||
+ | Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице [[Платформа_3V/Справочник/Cортировка|'''Сортировка элементов справочника (SortingOptions)''']] | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="width:800px; overflow:auto;"> | ||
+ | <div style="font-weight:bold;line-height:1.6;">JSON отчета с сортировкой Договоров по возрастанию по атр."Наименование"</div> | ||
+ | <div class="mw-collapsible-content mw-collapsed-content"> | ||
+ | <syntaxhighlight lang="JSON" line> | ||
+ | { | ||
+ | "workflowId": null, | ||
+ | "leftHeader": { | ||
+ | "useLazyDataLoadingStrategy": false, | ||
+ | "dictionaries": [ | ||
+ | { | ||
+ | "showDataIfAbsentFilter": null, | ||
+ | "coordAttribute": null, | ||
+ | "cartesianOptions": "Default", | ||
+ | "canSelectAttribute": null, | ||
+ | "groupingOptions": null, | ||
+ | "groupingMethod": "Default", | ||
+ | "sortingOptions": null, | ||
+ | "rootElement": null, | ||
+ | "virtualElements": null, | ||
+ | "displayValueOptions": null, | ||
+ | "displayAttribute": null, | ||
+ | "dictionaryId": 84, | ||
+ | "filter": { | ||
+ | "value": null, | ||
+ | "skipIfValueNull": false, | ||
+ | "attributeId": null, | ||
+ | "attribute": { | ||
+ | "id": 1, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "conditionType": "AllElements", | ||
+ | "inversion": false, | ||
+ | "discriminator": "ValueConditionalDictionaryFilterDto" | ||
+ | }, | ||
+ | "selection": null, | ||
+ | "hierarchyId": null, | ||
+ | "limit": null | ||
+ | } | ||
+ | ], | ||
+ | "dictionaryAttributesLinks": [], | ||
+ | "specialFilters": { | ||
+ | "filtersByDataOptions": { | ||
+ | "filtersByData": [], | ||
+ | "needRestoreFullHierachy": false, | ||
+ | "joinOption": "Or", | ||
+ | "restoreElements": null | ||
+ | }, | ||
+ | "dictionaryAttributesLinks": [], | ||
+ | "needRestoreFullHierachy": false, | ||
+ | "restoreElements": null | ||
+ | }, | ||
+ | "isEditable": false | ||
+ | }, | ||
+ | "topHeader": { | ||
+ | "topHeaderItems": [ | ||
+ | { | ||
+ | "dictionaryAttributes": [ | ||
+ | { | ||
+ | "dictionaryId": 84, | ||
+ | "attribute": { | ||
+ | "id": 2, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "attributeId": null, | ||
+ | "displayAttributeType": "AttributeName", | ||
+ | "displayAttributeName": null, | ||
+ | "addFirstElementValue": false, | ||
+ | "overwriteNotFirstElementValues": true, | ||
+ | "delimiter": ", ", | ||
+ | "hideAttributeNameInHeader": false, | ||
+ | "headerNameDelimiter": " / ", | ||
+ | "duplicateValuesForNextDictionaries": true, | ||
+ | "duplicateValuesForNextRows": true, | ||
+ | "displayValueOptions": null, | ||
+ | "linkedAttributeSettings": null, | ||
+ | "skippedFilterAttributesByLink": [], | ||
+ | "filterOptionsByLinks": null | ||
+ | } | ||
+ | ], | ||
+ | "settings": null, | ||
+ | "hyperlinkOptions": null, | ||
+ | "hasImage": false, | ||
+ | "columnOptions": null, | ||
+ | "discriminator": "AttributeHeaderItemDto" | ||
+ | }, | ||
+ | { | ||
+ | "dictionaryAttributes": [ | ||
+ | { | ||
+ | "dictionaryId": 84, | ||
+ | "attribute": { | ||
+ | "id": 21, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "attributeId": null, | ||
+ | "displayAttributeType": "AttributeName", | ||
+ | "displayAttributeName": null, | ||
+ | "addFirstElementValue": false, | ||
+ | "overwriteNotFirstElementValues": true, | ||
+ | "delimiter": ", ", | ||
+ | "hideAttributeNameInHeader": false, | ||
+ | "headerNameDelimiter": " / ", | ||
+ | "duplicateValuesForNextDictionaries": true, | ||
+ | "duplicateValuesForNextRows": true, | ||
+ | "displayValueOptions": null, | ||
+ | "linkedAttributeSettings": null, | ||
+ | "skippedFilterAttributesByLink": [], | ||
+ | "filterOptionsByLinks": null | ||
+ | } | ||
+ | ], | ||
+ | "settings": null, | ||
+ | "hyperlinkOptions": null, | ||
+ | "hasImage": false, | ||
+ | "columnOptions": null, | ||
+ | "discriminator": "AttributeHeaderItemDto" | ||
+ | }, | ||
+ | { | ||
+ | "dictionaryAttributes": [ | ||
+ | { | ||
+ | "dictionaryId": 84, | ||
+ | "attribute": { | ||
+ | "id": 22, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "attributeId": null, | ||
+ | "displayAttributeType": "AttributeName", | ||
+ | "displayAttributeName": null, | ||
+ | "addFirstElementValue": false, | ||
+ | "overwriteNotFirstElementValues": true, | ||
+ | "delimiter": ", ", | ||
+ | "hideAttributeNameInHeader": false, | ||
+ | "headerNameDelimiter": " / ", | ||
+ | "duplicateValuesForNextDictionaries": true, | ||
+ | "duplicateValuesForNextRows": true, | ||
+ | "displayValueOptions": null, | ||
+ | "linkedAttributeSettings": null, | ||
+ | "skippedFilterAttributesByLink": [], | ||
+ | "filterOptionsByLinks": null | ||
+ | } | ||
+ | ], | ||
+ | "settings": null, | ||
+ | "hyperlinkOptions": null, | ||
+ | "hasImage": false, | ||
+ | "columnOptions": null, | ||
+ | "discriminator": "AttributeHeaderItemDto" | ||
+ | }, | ||
+ | { | ||
+ | "dictionaryAttributes": [ | ||
+ | { | ||
+ | "dictionaryId": 84, | ||
+ | "attribute": { | ||
+ | "id": 23, | ||
+ | "discriminator": "OwnAttributeDefinitionDto" | ||
+ | }, | ||
+ | "filter": null, | ||
+ | "sortingOptions": null, | ||
+ | "attributeId": null, | ||
+ | "displayAttributeType": "AttributeName", | ||
+ | "displayAttributeName": null, | ||
+ | "addFirstElementValue": false, | ||
+ | "overwriteNotFirstElementValues": true, | ||
+ | "delimiter": ", ", | ||
+ | "hideAttributeNameInHeader": false, | ||
+ | "headerNameDelimiter": " / ", | ||
+ | "duplicateValuesForNextDictionaries": true, | ||
+ | "duplicateValuesForNextRows": true, | ||
+ | "displayValueOptions": null, | ||
+ | "linkedAttributeSettings": null, | ||
+ | "skippedFilterAttributesByLink": [], | ||
+ | "filterOptionsByLinks": null | ||
+ | } | ||
+ | ], | ||
+ | "settings": null, | ||
+ | "hyperlinkOptions": null, | ||
+ | "hasImage": false, | ||
+ | "columnOptions": null, | ||
+ | "discriminator": "AttributeHeaderItemDto" | ||
+ | } | ||
+ | ], | ||
+ | "needFilterAttributesByLinks": false, | ||
+ | "enableFilterByLinks": false, | ||
+ | "numerationSettings": null, | ||
+ | "filterOptions": null | ||
+ | }, | ||
+ | "parameters": [], | ||
+ | "styles": [], | ||
+ | "styleOptions": [], | ||
+ | "stylesTemplate": [], | ||
+ | "filtersByDataOptions": null, | ||
+ | "view": { | ||
+ | "isTopHeaderHidden": false, | ||
+ | "areRowsColumnsNamesHidden": false, | ||
+ | "transposeOptions": null, | ||
+ | "isStylesTemplateEnabled": false, | ||
+ | "topHeaderStyleId": null, | ||
+ | "leftHeaderExpandedLevel": 2, | ||
+ | "fixedColumn": null, | ||
+ | "pagingOptions": null, | ||
+ | "emptyValueDisplayString": null, | ||
+ | "disabledEvents": null, | ||
+ | "disableVirtualScroll": false, | ||
+ | "defaultRowPixelHeight": null, | ||
+ | "gridComponent": null, | ||
+ | "disableRefreshWhenParameterChanged": false, | ||
+ | "maxRowsCount": null, | ||
+ | "sortings": [ | ||
+ | { | ||
+ | "column": 0, | ||
+ | "sortDirection": "Descending", | ||
+ | "nullsSortingMode": "PlaceLast", | ||
+ | "discriminator": "PivotColumnSortingDto" | ||
+ | } | ||
+ | ], | ||
+ | "buttons": null, | ||
+ | "filters": null, | ||
+ | "isReadOnly": false, | ||
+ | "leftHeaderElementsCount": null | ||
+ | }, | ||
+ | "externalExecutions": null, | ||
+ | "settings": null, | ||
+ | "code": "P_Сортировка по столбцу", | ||
+ | "id": 86, | ||
+ | "name": "Сортировка по столбцу" | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | </div></div> | ||
== Сортировка по справочнику == | == Сортировка по справочнику == | ||
− | + | Основным отличием от сортировки по столбцу является то, что сортировка может производится только по определенным атрибутам справочника, находящегося в строках отчета. | |
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Строка 47: | Строка 299: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
Строка 94: | Строка 347: | ||
"displayValueOptions": null, | "displayValueOptions": null, | ||
"displayAttribute": null, | "displayAttribute": null, | ||
− | "dictionaryId": | + | "dictionaryId": 84, |
"filter": { | "filter": { | ||
"value": null, | "value": null, | ||
Строка 131: | Строка 384: | ||
"dictionaryAttributes": [ | "dictionaryAttributes": [ | ||
{ | { | ||
− | "dictionaryId": | + | "dictionaryId": 84, |
"attribute": { | "attribute": { | ||
"id": 2, | "id": 2, | ||
Строка 163: | Строка 416: | ||
"dictionaryAttributes": [ | "dictionaryAttributes": [ | ||
{ | { | ||
− | "dictionaryId": | + | "dictionaryId": 84, |
"attribute": { | "attribute": { | ||
"id": 21, | "id": 21, | ||
Строка 195: | Строка 448: | ||
"dictionaryAttributes": [ | "dictionaryAttributes": [ | ||
{ | { | ||
− | "dictionaryId": | + | "dictionaryId": 84, |
"attribute": { | "attribute": { | ||
"id": 22, | "id": 22, | ||
Строка 227: | Строка 480: | ||
"dictionaryAttributes": [ | "dictionaryAttributes": [ | ||
{ | { | ||
− | "dictionaryId": | + | "dictionaryId": 84, |
"attribute": { | "attribute": { | ||
"id": 23, | "id": 23, | ||
Строка 270: | Строка 523: | ||
"externalExecutions": null, | "externalExecutions": null, | ||
"settings": null, | "settings": null, | ||
− | "code": "P_Сортировка | + | "code": "P_Сортировка по справочнику ", |
− | "id": | + | "id": 83, |
− | "name": "Сортировка | + | "name": "Сортировка по справочнику" |
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div></div> | </div></div> | ||
<br> | <br> | ||
− |
Версия 14:04, 22 апреля 2021
Сортировка - это последовательное расположение элементов. Сортировка в отчете реализуется двумя способами:
- Сортировка по столбцу
- Сортировка по справочнику
Исходный справочник:
Сортировка по атрибуту "Наименование":
Сортировка по столбцу
При сортировке по столбцу данные, по которым происходит сортировка, могут являться как значениями атрибутов справочника или показателя, так и быть расчетными
"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)
Сортировка по справочнику
Основным отличием от сортировки по столбцу является то, что сортировка может производится только по определенным атрибутам справочника, находящегося в строках отчета.
"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)