Developer

OnSortQuery

Occur when user click on Column's header, just before sort method is called.

property OnSortQuery: TNxSortQueryEvent read FOnSortQuery write FOnSortQuery;
Accept (var) parameter may be used in order to deny sorting. SortKind parameter indicate intended sorting direction.

If sorting is completed (Accept is set to True) OnAfterSort event is called.

Example:


Following example intercept User's action if 2nd column is going to be sorted in ascending order.

procedure TForm1.NextGrid61SortQuery(Sender: TObject; Index: Integer; SortKind: TNxSortKind; var Accept: Boolean); begin if (Index = 1) and (SortKind = skAscending) then begin // Cancel this sorting Accept := False; // Instead, sort by other column NxNumberColumn61.SetSort(True, stNumeric, skDescending); end; end;

See also