AdvWebGrid header

TTIWAdvWebGrid shows headings out of alignment with Scroll Style set to scAuto. Headings show ok with scNever. Is there a workaround?

Hi,

Can you please make sure the column widths are adjusted to the cell content?
In this case the width of the Info column should be increased to fit the content.

Still having trouble. Column widths are wide enough:

Can you please provide the following information so I can further investigate this?

  • The version of IntraWeb you are using
  • A ready to run sample project that demonstrates the issue

error.zip (70.5 KB) IW 14.2.7

Thank you for providing a sample project.
We are currently investigating this issue and will report back as soon as possible.

if iw 15 fixes the problem I am happy to upgrade

is iw15 supported ?

IW 15 is indeed supported for the TIWAdvWebGrid, but this does not have any influence on this particular behaviour.

Please try adding the following code to your sample to avoid the issue:

procedure TBenefitForm.IWAppFormCreate(Sender: TObject);
var
  I: Integer; begin
{ set_title; }

  set_columns;                                            {has defining logic}

  for I := 0 to ItemsAdvGrid.Columns.Count - 1 do
    ItemsAdvGrid.Columns[I].WidthType := wtAbsolute;

  ItemsAdvGrid.Columns[0].Width := 30;
  ItemsAdvGrid.Columns[1].Width := 30;
  ItemsAdvGrid.Columns[2].Width := 30;
  ItemsAdvGrid.Columns[3].Width := 30;
  ItemsAdvGrid.Columns[4].Width := 40;
  ItemsAdvGrid.Columns[5].Width := 100;
  ItemsAdvGrid.Columns[6].Width := 100;
  ItemsAdvGrid.Columns[7].Width := 100;
  ItemsAdvGrid.Columns[8].Width := 70;
  ItemsAdvGrid.Columns[9].Width := 80;
...

thanks, I simply needed to widen the columns

for colw := 0 to Columns.Count-1 do with Columns[colw] do begin
WidthType := wtAbsolute;
Width := round(Width*1.5);
end;

Hi,
I'm experiencing same problem. I've tried solutions in present post (including different factors for widening, from 1.25 to 2), without success. Just 2 points:
a) Adjust of columns with to cell contents. How to do it?
b) I'm using Intraweb 16 and Delphi 12.1 CE

Here is my code:

procedure AnadirColumnaLista(var Lista: TTIWDBAdvWebGrid; CampoDB,
Titulo: String; SoloLectura: Boolean = False; Es_Visible: Boolean = True;
Header_Font_Size: Integer = 12; Cell_Font_Size: Integer = 10;
Ancho: Integer = 0; Alineacion: TAlignment = taLeftJustify);
begin
With Lista do
begin
With Columns.Add do
begin
Alignment := Alineacion;
Allowsizing := true;
Columntype := ctNormal;
DataField := CampoDB;
ColumnHeaderFont.Size := Header_Font_Size;
ColumnHeaderAlignment := taCenter;
ColumnHeaderClick := False;
// ColumnHeaderFont.Style := [fsBold];
Font.Size := Cell_Font_Size;
Font.Style := ;
Title := Titulo;
Enabled := NOT SoloLectura;
Visible := Es_Visible;
if Ancho > 0 then
begin
Width := Ancho;
Widthtype := wtAbsolute;
UseFullWidth := False;
end
else begin
Widthtype := wtAbsolute;
// Widthtype := wtPercent;
// Width := 100;
// UseFullWidth := True;
end;
end;
end;
end;

procedure TMod_Taller.MontarColumnasListaColores(var Lista: TTIWDBAdvWebGrid; Filas: Integer = 0);
var
AnchoTotal : Integer;
AnchoColumna : Integer;
TamanoFuenteCabecera : Integer;
TamanoFuenteColumna : Integer;
I : Integer;
begin
Rutinas_IW.BorrarColumnasDBGrid (Lista);
with Lista do
begin
DataSource := DataComun.DSrc2;
// Columns.Add; // Columna vacía
end;

TamanoFuenteCabecera := 14;
TamanoFuenteColumna := 14;
with Lista do
begin
if Filas = 0 then
Rowcount := CalcularFilas (Lista)
else
RowCount := Filas;
RowOffset := 5;
UseFullWidth := True;
ColumnHeaderFont.Size := TamanoFuenteCabecera;
Font.Size := TamanoFuenteColumna;
AnchoTotal := Width;
AnchoColumna := (AnchoTotal DIV 6);
end;

// AnadirColumnaLista(Lista, '', 'Color', true, True, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);
AnadirColumnaLista(Lista, 'Codigo_Color', 'Cód. Color', true, false, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);
AnadirColumnaLista(Lista, 'Descripcion', 'Nombre Color', true, true, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);
AnadirColumnaLista(Lista, 'RAL', 'RAL', true, true, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);
AnadirColumnaLista(Lista, 'NumPiezas', 'Piezas', true, true, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna, taRightJustify);
AnadirColumnaLista(Lista, 'TotalSuperficie', 'm2', true, true, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna, taRightJustify);
AnadirColumnaLista(Lista, 'KilosPintura', 'Kilos', true, true, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna, taRightJustify);
AnadirColumnaLista(Lista, 'RGB', 'RGB', true, false, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);
AnadirColumnaLista(Lista, 'Desc_RAL', 'Desc. RAL', true, True, TamanoFuenteCabecera, TamanoFuenteColumna, AnchoColumna);

for I := 0 to Lista.Columns.Count - 1 do
begin
Lista.Columns[I].WidthType := wtAbsolute;
end;

for I := 0 to Lista.Columns.Count-1 do
with Lista.Columns[I] do begin
WidthType := wtAbsolute;
// Width := round(Width*1.5);
end;
Lista.Visible := True;

end;

And Grid shown:

Any idea about how to proceed?

Hi,

Have you tried using an absolute value for Columns[].Width instead?

For example:
Grid.Columns[0].Width := 100;

Then make the value higher as long as the issue is visible.

Hi,
Actually I'm using absolute values. If you look at the code, I create columns using following procedure:
AnadirColumnaLista(Lista, ColumnTitle, ColumnDataField, ReadOnlyProperty, VisibleProperty, ColumnHeaderFontSize, DataFontSize, Ancho, DataColumnAlignment);
"Ancho" is an absolute value for column width:
if Ancho > 0 then
begin
Width := Ancho;
Widthtype := wtAbsolute;
UseFullWidth := False;
end
else begin
Widthtype := wtAbsolute;
// Widthtype := wtPercent;
// Width := 100;
// UseFullWidth := True;
end;

I've observed that columns width are different from specified and, the most important, header column width is different from data column width.
Best regards,
Venancio Lasquibar

Unfortunately, this is a known issue. Sometimes, header and data columns may not be rendered at the exact specified width due to their content. Therefore the widths of header and data columns may differ slightly because they are rendered separately to support vertical scrolling.

Have you tried increasing the Column Width value to see if that helps?
Alternatively you can disable vertical scrolling in the grid to ensure consistent column widths.

Hi Bart,
As I don't know how to disable only vertical scrolling, I've changed Scroll.Style to scNone, ant that fixed my problem!
Is there any plan to fix the issue in a new version of Grid control?

Best regards,
Venancio Lasquibar

Hi Venacio,

Addressing this issue would require significant modifications to the source code. At this time, there are no plans to implement such changes. Moving forward, our primary focus will be on TMS WEB Core.