Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxGridColumn.OnHeaderClick Event

Allows you to respond to clicks on the column header.

#Declaration

Delphi
property OnHeaderClick: TNotifyEvent read; write;

#Remarks

The OnHeaderClick event occurs every time a user clicks on the column header. For instance, you can handle the OnHeaderClick event to sort data against the current column when sort operations are disabled (the Options.Sorting property is set to False).

#Code Example: Allow Sort Operations for Individual Columns

The following code example sorts data against the current column when sort operations are disabled:

uses
  ..., dxCore;
//...
procedure TMyForm.Column1HeaderClick(Sender: TObject);
var
  AColumn: TcxGridColumn;
begin
  AColumn := Sender as TcxGridColumn;
  if AColumn.SortOrder = soDescending then
    AColumn.SortOrder := soAscending
  else
    AColumn.SortOrder := soDescending;
end;
See Also