Skip to main content

TcxGridColumn.OnHeaderClick Event

The event is fired on clicking the column header in a (Banded) Table View.

Declaration

property OnHeaderClick: TNotifyEvent read; write;

Remarks

The OnHeaderClick event occurs when a user clicks the header of the current column. For instance, a user can handle the OnHeaderClick event in order to perform sorting by the specific column values when sorting is restricted for that column (the column’s Options.Sorting property value is False).

The following code shows how to perform sorting by the PaymentType column values when sorting is disabled for that column at design time:

uses
  ..., dxCore;
//...
procedure TColumnsSimpleDemoMainForm.<View>PaymentTypeHeaderClick(Sender: TObject);
begin
  with TcxGridColumn(Sender) do
  begin
    if SortOrder = soDescending then
      SortOrder := soAscending
    else
      SortOrder := soDescending;
  end;
end;
See Also