Jump to content

Hyperlinks in dbgrid


d.bernaert

Recommended Posts

Hi,

I have several columns in my unidbgrid which is connected to a table.

Now I would like to display certain columns in the grid as a hyperlink, so the text value coming from the table should be converted to a hyperlink.

When the user clicks a certain field which is a hyperlink, I would like to execute an action.

It is my intention to avoid using an action column this way.

How can this be achieved?

Thx,

Dominique

Link to comment
Share on other sites

Hi ,

We construct a hyperlink in the query which is used for de the dbgrid. 

 <a href=http://onxxxx.xxxx.nl/DModules/SW.AutoLogon/Poster.aspx?Pid=0&Tid=148&Mid=537&UserName=' +  CAST(user.id AS VARCHAR) + '&Password=' + user.Password +' target=_BLANK">inloggen</a>' as [Login]

Works perfect for us.

regards

leon

Link to comment
Share on other sites

Hi,

like a hyperlink, not a real hyperlink.

I want to simulate the functionality of an action column. For instance a grid with the name of the customer, his address, and invoice number.

When clicking on the customer name I want to open the customer details in pop-up form.

When clicking on the invoice number i want to show the invoice details in pop-up form.

Dominique

Link to comment
Share on other sites

On 1/5/2019 at 1:37 AM, d.bernaert said:

like a hyperlink, not a real hyperlink.

I want to simulate the functionality of an action column. For instance a grid with the name of the customer, his address, and invoice number.

When clicking on the customer name I want to open the customer details in pop-up form.

 When clicking on the invoice number i want to show the invoice details in pop-up form.

One possible solution

1. UniDBGrid1 -> OnDrawColumnCell:

procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
  ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
  if SameText(Column.FieldName, 'InvoiceNumber') then
    Attribs.Style.Style := 'cursor:pointer;text-decoration: underline';

end;

2. UniDBGrid1 -> OnCellClick:

procedure TMainForm.UniDBGrid1CellClick(Column: TUniDBGridColumn);
begin
  if SameText(Column.FieldName, 'InvoiceNumber') then
  begin
    // your logic
  
  end;

end;

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...