Use Indexfieldnames in FMX

Asked

Viewed 53 times

0

I’m trying to use the IndexFieldNames inside the FMX to organize the data according to the column but when calling the method HeaderClick, I can’t get the Column name and only its content. Using Delphi 10.3

I wonder how I can get the name of the column to insert in IndexFieldNames Follow a piece of my code.

procedure TFConTitulos.GDTitulosHeaderClick(Column: TColumn);
var

Number : integer;
Name: string;

begin
  Number:= Column.Index;{ so consegui pegar o indice da columa selecionada}
Name:= {codigo vai aqui }
  UDM.FDConTiti.Close;

  UDM.FDConTiti.IndexFieldNames := Name;

  UDM.FDConTiti.Open;

end;
  • This Fdcontiti is a Tfdconnection or a Tfdtable/Tfdquery?

  • It’s a Tfdquery I tested the assignment on it directly and it works, so my problem is capturing the Field name of the column. In other words, I need the command similar to the VCL Column.FieldName for FMX.

1 answer

0

Solution I found. Not the best but helped.

  Number:= Column.Index;
  Name := GDTitulos.ColumnByIndex(Number).Header;

  case Number of

  1: Name:= 'ID_TITULO';
  4: Name:= 'NOME_FANTASIA';
  5: Name:= 'NUMERO_NOTA';
  9: Name:= 'DATA_VENC';
  12: Name:= 'VALOR_T_TITULO';

  end;

  UDM.FDConTiti.Close;
  UDM.FDConTiti.IndexFieldNames:= Name;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.