Sorter¶
This control renders a Sorter FormCell to be used in a filter-options page. It allows user to choose the field to be used as sorter.
Sorter Properties¶
Property | Type | Required | Default |
---|---|---|---|
AllowEmptySelection | boolean |
Optional | true |
Caption | string |
Optional | |
FormatRule | Rule | Optional | "" |
HelperText | string |
Optional | |
IsEditable | boolean |
Optional | true |
IsVisible | boolean |
Optional | true |
SortByItems | complex | Required | |
_Name | string |
Required | |
_Type | const |
Required | |
validationProperties | ValidationProperties | Optional |
AllowEmptySelection¶
Disables or enables the selection of empty value set.
- type:
boolean
- default:
true
Caption¶
Displays label on the control.
- type:
string
FormatRule¶
If specified, the given rule executes when a control is initialized or when a value changes.
- type: Rule
- default:
""
HelperText¶
iOS and Web only. Helper text to be displayed if there is no validation view.
- type:
string
IsEditable¶
Indicates if the cell’s value may be modified.
- type:
boolean
- default:
true
IsVisible¶
Sets the visibility of the control.
- type:
boolean
- default:
true
SortByItems¶
The items to sort by.
- type: complex
SortByItems Value¶
Any following options needs to be fulfilled.
Option 1¶
Array type:
All items must be of the type: string
Option 2¶
_Name¶
- type:
string
_Type¶
- type:
const
The value of this property must be equal to:
"Control.Type.FormCell.Sorter"
validationProperties¶
The validation view properties.
- type: ValidationProperties
Examples¶
With a simple fixed collection specifier¶
{
"_Type": "Page",
"_Name": "FilterPage",
"Controls": [
{
"_Type": "Control.Type.FormCellContainer",
"_Name": "FormCellContainer",
"Sections": [
{
"Controls": [{
"_Type": "Control.Type.FormCell.Sorter",
"_Name": "OrderBy",
"AllowEmptySelection": true,
"Caption": "Sort By",
"SortByItems": ["OrderId", "BusinessArea", "OrderType"],
"IsEditable": true,
"HelperText": "This is helper text"
}]
}
]
}
]
}
With a complex fixed collection specifier¶
{
"Controls": [
{
"Sections": [
{
"Controls": [{
"_Type": "Control.Type.FormCell.Sorter",
"_Name": "SortFilter",
"AllowEmptySelection": false,
"Caption": "Sort By",
"SortByItems": [{
"ReturnValue": "OrderId",
"DisplayValue": "Job ID"
}, {
"ReturnValue": "OrderDescription",
"DisplayValue": "Description"
}, {
"ReturnValue": "Priority",
"DisplayValue": "Priority"
}],
"IsEditable":true
}]
}
]
}
]
}
Sorter queries having asc/desc attribute and sorter queries with multiple attributes.¶
{
"Controls": [
{
"Sections": [
{
"Controls": [{
"_Type": "Control.Type.FormCell.Sorter",
"_Name": "SortFilter",
"AllowEmptySelection": false,
"Caption": "Sort By",
"SortByItems": [
{
"ReturnValue": "OrderId desc",
"DisplayValue": "OrderId Descending"
},
{
"ReturnValue": "OrderId asc",
"DisplayValue": "OrderId Ascending"
},
{
"ReturnValue": "Priority ,OrderId",
"DisplayValue": "Priority (default ascending) and then OrderId (default ascending)"
},
{
"ReturnValue": "Priority desc ,OrderId",
"DisplayValue": "Priority descending and then OrderId (default ascending)"
},
{
"ReturnValue": "Priority ,OrderId desc",
"DisplayValue": "Priority (default ascending) and then OrderId descending"
}
{
"ReturnValue": "Priority desc ,OrderId asc",
"DisplayValue": "Priority descending and then OrderId ascending"
}],
"IsEditable":true
}]
}
]
}
]
}
Sorter Form Cell with Rule and Global support¶
{
"Controls": [
{
"Sections": [
{
"Controls": [{
"_Type": "Control.Type.FormCell.Sorter",
"_Name": "SortFilter",
"AllowEmptySelection": false,
"Caption": "Sort By",
"SortByItems": [
{
"ReturnValue": "/MDKDevApp/Globals/DescendingSorter.global",
"DisplayValue": "Descending order of BusinessArea"
},
{
"ReturnValue": "/MDKDevApp/Rules/SorterQueries/AscendingSorterQuery.js",
"DisplayValue": "Ascending order of OrderType"
},
{
"ReturnValue": "/MDKDevApp/Rules/SorterQueries/DescendingSorterQuery.js",
"DisplayValue": "Descending order of OrderType"
},
{
"ReturnValue": "/MDKDevApp/Rules/SorterQueries/MultipleColumnSorterQuery.js",
"DisplayValue": "Descending order of BusinessArea and then ascending order of OrderId"
}],
"IsEditable":true
}]
}
]
}
]
}
// AscendingSorterQuery.js - Rule returing sorter query string
function AscendingSorterQuery() {
return "OrderType asc";
}
// DescendingSorterQuery.js - Rule returing promise of sorter query string
function DescendingSorterQuery() {
return Promise.resolve("OrderType desc");
}
// MultipleColumnSorterQuery.js - Rule returing promise of sorter query string with multiple attributes
export default function MultipleColumnSorterQuery() {
return Promise.resolve("BusinessArea desc, OrderId asc");
}