Topic: how to disable sorting by header

hello all

how to disable sorting by table grid header

thanks for help

Re: how to disable sorting by header

Hello Derek, Hello kofa

Kofa, if you want to do the same on all the columns of a grid (why not), you can use a loop:

procedure Form1_TableGrid1_OnChange (Sender: TObject);
var    q,iCol   : integer;
begin
     
      q := Form1.TableGrid1.Columns.Count-1;                     //  On centre toutes les en-tête des colonnes
      for iCol := 0 to q do
         begin
             Form1.TableGrid1.Columns[icol].Header.Alignment := taCenter;
             Form1.Tablegrid1.Columns[icol].Options := form1.tablegrid1.columns[icol].options - cocanclick;  // On désactive le tri depuis l'en-tête de la colonne
         end;
end;

JB

Re: how to disable sorting by header

thank you derek and jean.brezhonek

it works fine

thanks for help