Use the SortRequest event
- Last Updated: June 19, 2019
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Syntax
.NET UI controls that rely on their data
source for sorting, like the System.Windows.Forms.DataGridView, publish
the SortRequest event. The ProBindingSource publishes
the SortRequest event when a user action causes the bound UI control to
request a sort from the ProBindingSource. This event uses an OpenEdge built-in
class, Progress.Data.SortRequestEventArgs,
that extends the .NET System.EventArgs class
to pass the event arguments. The event argument class contains the FieldIndex, FieldName, ArrayIndex, Ascending, and Sorted properties.
DataGridView, the UltraGrid does
not publish this event.An event handler for this event uses the following syntax:
|
Where EventHandlerName is the name of the event handler, sender is the object reference to the ProBindingSource, and args is the object reference to the SortRequestEventArgs instance that contains the event arguments.
If the bound ABL data source object is a ProDataSet, this event always refers to the top-level query. If your application needs to sort the child records, one approach is to create two ProBindingSource objects, one for the parent and one for the child, and to display the child records for a specific parent record in another UI control.
When this event occurs, the
event handler must use a modified sort criteria based on the values
in the SortRequestEventArgs object to reopen the query associated
with the ABL data source object. The FieldIndex, FieldName,
and ArrayIndex properties indicate the field on
which to sort the query. The Ascending property
indicates the order of the sort, with the TRUE meaning an ascending
sort and FALSE meaning a descending sort. The event
handler should set the Sorted property to TRUE when
the query reopens successfully with the new sort criteria.
The FieldIndex, FieldName,
and ArrayIndex properties combine to indicate the
new sort field. FieldName is the unqualified field
name as specified in the ProBindingSource. Even if you had to qualify
the field name in the constructor, the FieldName is
unqualified in the SortRequestEventArgs class. FieldIndex is
a 1-based index of the ProBindingSource fields in the order that
they appear in the constructor's included field list. If the specified
field is an array field, the ArrayIndex property
indicates the proper element in the array with a 1-based index of
the array elements.