Is it possible to get the Field-Value from TTMSFNCDataGridDatabaseAdapter in the TTMSFNCDataGrid.OnGetCellLayout
This would be really handy for defining formatting conditions externally based on database values instead of displayed values.
Is it possible to get the Field-Value from TTMSFNCDataGridDatabaseAdapter in the TTMSFNCDataGrid.OnGetCellLayout
This would be really handy for defining formatting conditions externally based on database values instead of displayed values.
Hi, you can use the following code to achieve the behavior your looking for. The code is based on the BioLife.xml (TClientDataSet)
procedure TForm1.TMSFNCDataGrid1GetCellLayout(Sender: TObject;
ACell: TTMSFNCDataGridCell);
var
o: Integer;
begin
if not Assigned(TMSFNCDataGridDatabaseAdapter1) or not TMSFNCDataGridDatabaseAdapter1.CheckDataSet then
Exit;
o := TMSFNCDataGridDatabaseAdapter1.DataLink.ActiveRecord;
try
if TMSFNCDataGridDatabaseAdapter1.SetActiveRecord(ACell.Row) then
begin
if TMSFNCDataGridDatabaseAdapter1.ColumnAtField['Category'].Field.AsString = 'Shark' then
ACell.Layout.Font.Color := gcRed;
end;
finally
TMSFNCDataGridDatabaseAdapter1.DataLink.ActiveRecord := o;
end;
end;