TMSFNCGridDatabaseAdapter w/ Web Core - After calling LoadAllDataAndDisconnect, data not being loaded when grid height is too short


In TMS Web Core, w/ FNCGrid & FNCGridDatabaseAdapter, when you call LoadAllDataAndDisconnect, and the grid's height is too short, not all data is assigned to cells.

I noticed LoadAllDataAndDisconnect basically assigns virtual cell data to persistent cell data; and when the grid height is enough for just some rows (in some cases, 3, 4... in other cases, 7), the grid rowcount is changed to the total recordcount, but most grid virtual cell data has not been retrieved, so, many rows are kept blank.

This doesn't happen in VCL.

Attached an example.
I took the WebCore/FNC/GridDatabaseAdapter demo, and made some changes:

Placed a new panel aligned to top, and moved in all edit controls, labels, buttons and navigator.
Aligned FNCGrid to bottom.
(for this purpose, I deleted the fish picture column and handling)

When you run it, before clicking "Connect", resize the window from the bottom until there's space for just 3 or 4 rows in the grid.
Now click "Connect", and then resize the windows again or scroll down the grid. Not all data is assigned, most will be blank.

Refresh the page (F5), and now resize it and leave space for at least 7 visible rows, press connect, and all data will be correctly assigned. (55.0 KB)

My application realtime video:

We noticed something changed in de way the LoadAllDataAndDisconnect is working. We are currently trying to find out the cause for this issue. In the meantime, please use the traditional code with First, Next looping through the dataset.

procedure TForm4.WebClientConnection1AfterConnect(Sender: TObject);
  I: Integer;
  TMSFNCGridDatabaseAdapter1.Active := False;

  TMSFNCGrid1.ColumnWidths[0] := 150;
  TMSFNCGrid1.ColumnWidths[1] := 100;
  TMSFNCGrid1.ColumnWidths[7] := 350;
//  TMSFNCGridDatabaseAdapter1.Columns[7].PictureField := True;
  TMSFNCGrid1.RowCount := 1;
  while not WebClientDataSet1.Eof do
    for I := 0 to WebClientDataSet1.FieldCount - 1 do
      TMSFNCGrid1.Cells[I, TMSFNCGrid1.RowCount] := WebClientDataSet1.Fields[I].AsString;

    TMSFNCGrid1.RowCount := TMSFNCGrid1.RowCount + 1;


I used another wacky aproach:

  r : TRect;
  a : TAlign;
  a := mygrid.Align;
  r := mygrid.BoundsRect;
  mygrid.Align := alNone;
  mygrid.Height := 600;
  myGridDBAdapter.Active := True;


  mygrid.Align := a;
  mygrid.BoundsRect := r;

I swear it worked! :smiley:


Must be something within GetCellData or those calculations of buffercount, with VisibleRowCount, rowheight, etc., but at another level/unit I neither couldn't find yet. All my tests just led to VisibleRowCount too low = problem.
VCL.TMSFNCGridDatabaseAdapter and WebLib.TMSFNCGridDatabaseAdapter are quite identical, and there's no "short grid" problem on VCL. Scale factor? Rounding? :man_shrugging:t4:

Thanks for notifying you found a workaround. We'll investigate as soon as time permits.