Hi,
I have not done it.
I think the reason for my problems is the art of creating the grid.
If read that the grid is painted in layers.
(grid body -> grid columns and rows -> grid cell)
At the top is the painting of the cell.
I think my assignments to focused row and hover row are ignored.
My example code:
- Code: Select all
uses IWCGJQCommon;
procedure TForm1.IWAppFormCreate(Sender: TObject);
var
JScript : TIWCGJScript;
begin
// 1.) Set color of second column to BLUE
JScript:= TIWCGJScript.Create;
try
with JScript do
begin
Clear;
Add('function (rowId,val,rawObject,cm,rdata){');
Add(' return " style=\" background:blue; \" ";');
Add('}');
end;
IWCGJQGrid1.JQGridOptions.ColModel[1].OnCellAttr.Script:= JScript.Text;
finally
JScript.Free;
end;
// 2.) Override the color of the focused row and hover row
with ExtraHeader do
begin
Add('<style type="text/css">');
Add(' .ui-jqgrid tr.jqgrow.ui-state-highlight { background: highlight !important; }');
Add(' .ui-jqgrid tr.jqgrow.ui-state-hover { background: green !important; }');
Add('</style>');
end;
end;
In the following example we check if the cellvalue is 0.
- Code: Select all
with JScript do
begin
Clear;
Add('function (rowId,val,rawObject,cm,rdata){');
Add(' if (rdata.col1 != "0") {'); // == "0") {');
Add(' return " style=\" background: LightPink \" ";');
Add(' }');
Add('}');
end;
Next idea, is it possible to check if the row is selected?
If yes, we can omit the color assignment.
Then the default drawing will display it correctly.
Kind regards