DisplayOrderHelper.ReorderValuesAsync method (1 of 2)
Sets a records display order to to requested value, and also renumbers other records in the group as required.
public static Task<bool> ReorderValuesAsync(IDbConnection connection, IDisplayOrderRow row,
ICriteria? filter = null, object? recordID = null, int newDisplayOrder = 1,
bool descendingKeyOrder = false, bool hasUniqueConstraint = false, bool preserveGaps = false,
CancellationToken cancellationToken = default)
| parameter | description |
|---|---|
| connection | Connection (required). |
| row | Row with a display order and ID field (should implement IDbIdRow interface). |
| filter | Filter that will determine the record group (can be null). |
| recordID | ID value of the record. |
| newDisplayOrder | New display order of the record. |
| descendingKeyOrder | Will records with same display order values be sorted in ascending or descending ID order? |
| hasUniqueConstraint | True if the display order field has a unique index |
| preserveGaps | When false (default) all display order values in the group are normalized to consecutive values starting from 1, closing any gaps. When true, only the records between the old and the new position are renumbered and the existing display order values (including any gaps) are preserved where possible, so fewer rows are updated. |
| cancellationToken | Cancellation token |
Return Value
A task whose result is true if any of the display order values is changed.
See Also
- interface IDisplayOrderRow
- interface ICriteria
- class DisplayOrderHelper
DisplayOrderHelper.ReorderValuesAsync method (2 of 2)
Asynchronously sets a records display order to to requested value, and also renumbers other records in the group as required.
public static Task<bool> ReorderValuesAsync(IDbConnection connection, string tableName,
Field keyField, Field orderField, ICriteria? filter = null, object? recordID = null,
int newDisplayOrder = 1, bool descendingKeyOrder = false, bool hasUniqueConstraint = false,
bool preserveGaps = false, CancellationToken cancellationToken = default)
| parameter | description |
|---|---|
| connection | Connection (required). |
| tableName | Table name (required). |
| keyField | ID field meta that will be used to locate the record (required). |
| orderField | Display order field meta. |
| filter | Filter that will determine the record group (can be null). |
| recordID | ID value of the record. |
| newDisplayOrder | New display order of the record. |
| descendingKeyOrder | Will records with same display order values be sorted in ascending or descending ID order? |
| hasUniqueConstraint | True if the entity has a unique constraint on display order column. |
| preserveGaps | When false (default) all display order values in the group are normalized to consecutive values starting from 1, closing any gaps. When true, only the records between the old and the new position are renumbered and the existing display order values (including any gaps) are preserved where possible, so fewer rows are updated. |
| cancellationToken | Cancellation token |
Return Value
A task whose result is true if any of the display order values is changed.
See Also
- class Field
- interface ICriteria
- class DisplayOrderHelper