⤷ Sort columns in DBGrid

Use the FieldName property of the DBGrid to set an index with the same name as the FieldName.

procedure TForm1.DBGrid1TitleClick(Column: TColumn);
begin
  (Column.Field.DataSet as TTable).IndexFieldNames:=Column.FieldName;
end;
More for developers