Followup on TWebStringGrid.OnGetCellClass question

I just installed TMS Web Core 2.6.1.3 and see that it has indeed solved the issue demonstrated in my previous post regarding the OnGetCellClass event not being fired. However, there still seems to be either a bug or a misunderstanding on my part about this event. The event handler in the demo that I attached to that post specifies that all cells in a given row should have the same class, but when I run it using 2.6.1.3 I see the following result where only one column has the desired class:


Is this a bug or is my handler incorrect?

The cell class can get updated when the cell changes. So, for the cells where you want the CSS to be changed, you'd need to update these cells (or just set the same value again for example) or first fill the cells that determine the color and then fill the other cells.

OK, I see that the following works as intended:

procedure TForm2.WebFormCreate(Sender: TObject);
procedure FillGrid;
var
  j: Integer;
begin
  WebStringGrid1.BeginUpdate;
  for j := 0 to WebStringGrid1.RowCount-1 do
    FormRecord(j);
  WebStringGrid1.EndUpdate;
end;
begin
  FillGrid;
  FillGrid;
end;

It would be nice if TWebStringGrid.Repaint or TWebStringGrid.Refresh were implemented to solve this.

An alternative way to directly set the CSS class is by using for all cells you wish to update:

grid.CellElements[col,row].setAttribute('class',ClassName);

Thanks for the tip.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.