My versión that change background color due a value of a column of a grid.
- Code: Select all
procedure TfrmParametrosPoliza.dbgAsegPolJQGridOptionsLoadComplete(
Sender: TObject; AParams: TStringList);
var
RowIds: TStrings;
i: Integer;
Data: ISuperObject;
Cls1: ISuperObject;
Cls2: ISuperObject;
RowsData: TIWCGJQVarArray;
begin
RowIds:= TStringList.Create;
try
Data:= SO();
Cls1:= SO();
Cls1.S['background']:= 'red';
Cls2:= SO();
Cls2.S['background']:= 'blue';
dbgAsegPol.GetRowIds(RowIds);
RowsData := dbgAsegPol.GetColValues(0);
// Paint the cels of the grid conditionally
for i:= 0 to RowIds.Count - 1 do
if RowsData[i] = '0104' then // Is a Live Section?
dbgAsegPol.JQGridOptions.SetRowData(RowIds[i],Data,Cls1)
else
dbgAsegPol.JQGridOptions.SetRowData(RowIds[i],Data,Cls2);
finally
RowIds.Free;
end;
end;
Best Regards to all