How to set cellattributes depending on a previous row field value?
Goal is to achieve a layout as shown here:
-
You could suppress the data painting using code like the following.
procedure TDataGridExportForm.wwDataGrid1CustomDrawCell(Sender: TObject;
CellAttributes: TwwCustomDrawCellAttributes);
var beforeState: string;
begin
if (CellAttributes.DataRow>0) and (CellAttributes.column<>nil) and (CellAttributes.column.FieldName='State') then
begin
beforeState:= (Sender as TwwDataGrid).GetValueByRecord('State', CellAttributes.DataRow-1, false).AsString;
if beforeState=CellAttributes.GetValue('State').AsString then
begin
CellAttributes.DoDefaultDrawContents:= false;
end;
end;
end;I don't think there is a simple way to suppress the lines though in FirePower. I think we would have to expand the current event to include lines.
You might also consider using the TwwTreeView as it can display a grid after you expand giving you a similar effect.
Please sign in to leave a comment.
Comments
1 comment