SortingOptions
Setting model for data sorting
Signature:
export interface SortingOptions
Remarks
When style is "exclusive", clicking the column header with the shift key operates as "inclusive".
When setting it as an option in Grid, you only need to enter the necessary information.
Example
grid.setSortingOptions({enabled: false});
Properties
Property | Type | Description |
---|---|---|
commitBeforeSorting | boolean | Whether to commit before sorting |
enabled | boolean | Whether columns can be sorted by clicking on the column header |
handleVisibility | HandleVisibility | How to display filter handles |
keepFocusedRow | boolean | Whether to maintain the currently focused row when sorting |
nullsOrder | NullsOrder | When sorting, place null, undefined, and '' first or last. |
outerSort | OuterSortCallback | boolean | The grid behaves as if it is sorted without actually sorting it. |
pageSorting | boolean | Whether to sort by current page |
showSortOrder | boolean | Whether to display sort order when sorting multiple columns |
sortDataRow | boolean | Whether to sort dataRows when the values of the fields to be sorted are the same |
style | SortStyle | How to specify sort status for multiple columns in a grid |
textCase | SortCase | Case sensitive |
toast | ToastOptions | Toast-related settings |
Properties Desc
commitBeforeSorting
Whether to commit before sorting
Type
- boolean
enabled
Whether columns can be sorted by clicking on the column header
Type
- boolean
Remarks:
orderBy() is executed regardless of the value of this property.
handleVisibility
How filter handles are displayed
Type
- HandleVisibility
keepFocusedRow
Whether to maintain the currently focused row when sorting
Type
- boolean
nullsOrder
When sorting, place null, undefined, and ''
first or last.
Type
- NullsOrder
outerSort
The grid behaves as if it is sorted without actually sorting it.
Type
- OuterSortCallback | boolean
Remarks:
It is used when reloading sorted data from the server rather than sorting using data in the DataProvider.
If set to true
, the user must specify the sorting state using grid.orderBy.
If you specify function
, the function will be called just before the onSortingChanged event.
Example:
grid.sortingOptions.outerSort = true;
grid.onCellClicked = (grid, clickData) {
// Example of sorting one field as the target
if (clickData.cellType === "header") {
const sortInfo = grid.getSortedFields();
const fieldName = clickData.fieldName;
const isSort = sortInfo && sortInfo.find(v => v.orgFieldName === fieldName);
// let sortOrder = isSort ? (isSort.direction === 'ascending' ? 'descending' : null) : 'ascending';
let sortOrder = (!isSort || isSort.direction === 'descending') ? 'ascending' : 'descending';
if (sortOrder) {
grid.orderBy([fieldName], [sortOrder]) // Grid only displays sort order in the header.
} else {
grid.orderBy([]);
}
getData(fieldName, sortOrder) // Perform dataProvider.setRows within getData.
}
}
pageSorting
Whether to sort based on the current page
Type
- boolean
showSortOrder
Whether to display sort order when sorting multiple columns
Type
- boolean
sortDataRow
Whether to sort dataRows when the values of the fields to be sorted are the same
Type
- boolean
style
How to specify sort status for multiple columns in a grid
Type
- SortStyle
textCase
Case sensitive
Type
- SortCase
toast
Toast-related settings
Type
- ToastOptions
Remarks:
It follows the ToastOptions model.