TwebDBGrid + right align a column

I can´t get a column to be right aligned. The column has editor geNumber, no ElementClassname, DatType cdText and Alignment taRightJustify.

The underlying TwebDBGrid has no ElementClassname and no ElementTableClassnames - I do not want to use any CSS.

What am I missing?

I retested this here but I cannot see such issue, column index 2 in this example was set to taRightJustify for Alignment:

image

Have a look here at the right most column:

The col is bound to a calculated field of type Float.

I see two grids, both have a left aligned last column.
Without knowing your settings, your code used, details, ... I cannot say anything useful

Please see the code below. This is the column in question:

  with grdRezeptZutaten.Columns.Add do begin 
    Alignment := taRightJustify;
    DataField := 'gcalzutat';
    Editor := geNumber;
    Title := 'Energie (kcal)';
    Width := 150;
  end;
var
  grdRezeptZutaten: TWebDBGrid;

  grdRezeptZutaten := TWebDBGrid.Create(Self);

  grdRezeptZutaten.Name := 'grdRezeptZutaten';
  grdRezeptZutaten.Parent := WebPanel;
  grdRezeptZutaten.AlignWithMargins := True;
  grdRezeptZutaten.Left := 10;
  grdRezeptZutaten.Top := 10;
  grdRezeptZutaten.Width := 793;
  grdRezeptZutaten.Height := 734;
  grdRezeptZutaten.Align := alClient;
  grdRezeptZutaten.Color := clWhite;
  with grdRezeptZutaten.Columns.Add do begin 
    DataField := 'LfdNr';
    Title := 'Pos.';
    Width := 60;
  end;
  with grdRezeptZutaten.Columns.Add do begin 
    DataField := 'Bezeichnung';
    Title := 'Bezeichnung';
    Width := 650;
  end;
  with grdRezeptZutaten.Columns.Add do begin 
    Alignment := taRightJustify;
    DataField := 'Menge';
    Title := 'Menge';
    Width := 100;
  end;
  with grdRezeptZutaten.Columns.Add do begin 
    ComboBoxItems.Strings := (;
    DataField := 'Einheit';
    Editor := geCombo;
    Title := 'Einheit';
    Width := 100;
  end;
  with grdRezeptZutaten.Columns.Add do begin 
    Alignment := taRightJustify;
    DataField := 'gcalzutat';
    Editor := geNumber;
    Title := 'Energie (kcal)';
    Width := 150;
  end;
  grdRezeptZutaten.DefaultRowHeight := 36;
  grdRezeptZutaten.DataSource := dsZutaten;
  grdRezeptZutaten.FixedCols := 0;
  grdRezeptZutaten.Options := [goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goAlwaysShowEditor, goFixedRowClick, goFixedRowDefAlign];
  grdRezeptZutaten.ParentFont := False;
  grdRezeptZutaten.TabOrder := 1;
  grdRezeptZutaten.HeightPercent := 100.000000000000000000;
  grdRezeptZutaten.WidthPercent := 100.000000000000000000;
  grdRezeptZutaten.OnCanEditCell := grdRezeptZutatenCanEditCell;
  grdRezeptZutaten.OnKeyDown := grdRezeptZutatenKeyDown;

The rightmost column of the left grid should be right alignbed, but isn´t.

I retested this by transforming the Demo\Basics\Dataset demo to show a grid with a last right-aligned column and this works without issues.


TMSWeb_Dataset.zip (53.5 KB)