Jump to content

launch download from dbgrid


delagoutte

Recommended Posts

hello,

i have a unidbgrid linked to a datasource that displayed a list of filename.

Actually if i'm using the event onDblClick and i have this code :

procedure TUniForm.GridDCEDblClick(Sender: TObject);
var urlFile : string;
begin

    urlfile := UniMainModule.GetUrlFileServer+'/?'+UniMainModule.getParameterCurrentFile;
    UniSession.AddJS('window.open('''+urlfile +''',''_blank'');');
  end;
end;

urlfile is a url that is on another webserver than unigui webserver.

SO when i double click on cell that must launch a file download.

 

WIth this methode i'm blocked by webbrowser because it think it is a popup. If i unblock popup security the file download is launched.

It's working but i think there must be a better solution without unblock popup security.

 

how would you do? hope I was clear enough

 

 

 

Link to comment
Share on other sites

Create a new calculated field, put link to the file there in OnCalcFields

DataSet.FieldByName('download').AsString := '<a href="' + UniMainModule.GetUrlFileServer+'/?'+UniMainModule.getParameterCurrentFile + '">Download</a>'

User will see an ordinary link in this cell which he can click.

Link to comment
Share on other sites

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...