Jump to content

Recommended Posts

Posted

Hello,

How to access the values in the summary row of TUniDBGrid? (not from the OnColumnSummaryResult event).

Thank you

 

grid summary demo.jpg

Posted

Hi Sherzod, thank you. I read the threads with the keyword 'summaryRenderer' but sorry I could not understand the JavaScript 😅

I need to read the text in the summary row. I just need to read, not write. Could you show me how to do that?

Thanks

Posted

Hello, 

Just to confirm — you want to read the summary row value on the client side, right? Could you maybe explain your goal a bit more?

Posted
53 minutes ago, Sherzod said:

Hello, 

Just to confirm — you want to read the summary row value on the client side, right? Could you maybe explain your goal a bit more?

Yes Sherzod. I want to read the summary row on the client side.

My goal is to make a procedure to create HTML table from UniDBGrid for printing purposes. The procedure would take a UniDBGrid as input, and produce HTML table from it.

I could read all data rows of the UniDBGrid from the underlying Dataset connected to the UniDBGrid, but I haven't been able to read the contents of summary row from the UniDBGrid.

Posted
On 6/12/2025 at 11:50 AM, jrp said:

Any news about this?

Hello,

One possible solution:

1. 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniDBGrid1.JSInterface.JSAssign('summaryValues', [UniDBGrid1.JSInterface.JSObject('')]);
end;

2. 

procedure TMainForm.UniDBGrid1ColumnSummaryResult(Column: TUniDBGridColumn;
  GroupFieldValue: Variant; Attribs: TUniCellAttribs; var Result: string);
var
  I : Integer;
  F : Real;
begin
  if SameText(Column.FieldName, 'quantity') then
  begin
    I:=Column.AuxValue;
    Result:=Format('Total Units: %d', [I]);
    Attribs.Font.Style:=[fsBold];
    Attribs.Font.Color:=clGreen;
    //(Column.Grid as TUniDBGrid).JSInterface.JSAssign('summaryValues.quantity', [VarToStr(Column.AuxValue)]);
    (Column.Grid as TUniDBGrid).JSInterface.JSAssign('summaryValues.quantity', [I]);
  end
  else if SameText(Column.FieldName, 'unitprice') then
  begin
    F:=Column.AuxValue;
    Result:='Total Cost: '+FormatCurr('0,0.00 ', F) + FmtSettings.CurrencyString;
    Attribs.Font.Style:=[fsBold];
    Attribs.Font.Color:=clNavy;
    //(Column.Grid as TUniDBGrid).JSInterface.JSAssign('summaryValues.unitprice', [VarToStr(Column.AuxValue)]);
    (Column.Grid as TUniDBGrid).JSInterface.JSAssign('summaryValues.unitprice', [F]);
  end;
  Column.AuxValue:=NULL;
end;

3. On the client side:

image.png.453a445f404091f8bd600fd491bdb1a2.png

image.png.3566e7ac24954679d140a0e04f2c212a.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...