TWebDbGrid row color issue

Hi!

I have a poblem with row colors in the TWebDbGrid component. Right after dataset opening the colors are not applied to rows. After tapping any row (I run the app on a tablet)., the colors reappear. I've made a small video, because describing it is very difficult (it's in the ZIP file because attachment restrictions):

IMG_7547.zip (512.4 KB)

I treid to use all of this:

  • grid.Update
  • grid.Hide+Show combination.
  • grid.Row := 0
  • grid.SetFocus

The code for getting the data:

  wdsPotPodrobno.Close;
  wdsPotPodrobno.QueryString := Qry;
  wdsPotPodrobno.Load;

After this all the rows are white, but should be white or green depending on a field value. After a tap it's immediately displayed correctly.

The code for row coloring (datToday is defined just once on form creation):

procedure TfrmLokacija.gridViewGetCellClass(Sender: TObject; ACol, ARow: Integer; AField: TField; AValue: string; var AClassName: string);
var
  datRow: string;
begin
  datRow   := gridView.Cells[2,ARow]; 

  if datRow >= datToday then begin
    AClassName := 'done';
  end;
end;

I would kindly ask for any suggestion, because I'm out of ideas :frowning:

When you first open the dataset, do you see the event OnGetCellClass is being called for all cells?

Yes, the breakpoint set on row AClassName := 'done'; is hit, but the row color is not updated.

I cannot reproduce an issue. This was retested with demo Demo\Basics\DBGrid and adding CSS

    <style>
    .redcell { color: red; }
    </style>

and code

procedure TForm1.WebDBGrid1GetCellClass(Sender: TObject; ACol, ARow: Integer;
  AField: TField; AValue: string; var AClassName: string);
begin
 if (acol = 2) and odd(Arow) then
   AClassName := 'redcell';
end;

and this works as expected.

If a problem persists with the latest version v2.5.4.0, please isolate this and provide a sample source app with which we can reproduce the problem.

Hello!

Ok.

In the meantime I found that this happens only on our android tablets. On the dev machine all works OK.

DId you check if OnGetCellClass is triggered on Android?