cancel
Showing results for 
Search instead for 
Did you mean: 

How do I open PDF and JPG in new window in sap.m.UploadCollection

Former Member
0 Kudos

Hi,

I'm using sap.m.UploadCollection to upload documents. It all works fine. File's being uploaded, and they are shown in the list.

When I click on the link in the list the file is downloaded again.  The only issue is this;


When I click on a text file, an image file or a PDF file,  it opens in the same browser window. Is there a way to open the link from sap.m.UploadCollection in a new browser window?


For an example I refer to the example in the SAPui5 SDK - Demokit:

https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.UploadCollection/preview

If you click on a text-file or pdf-file you'll see it will open in the same browser window.



with regards,

Michael Visser



Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

interesting, in 1.26.6 it is


oFileNameLabel = new sap.m.Link(sItemId + "-ta_filenameHL", {

  text : sFileNameLong,

  enabled : bEnabled,

  href : oItem.getUrl()

}).addStyleClass("sapMUCFileName");

and in 1.28.1 it is


oFileNameLabel = new sap.m.Link(sItemId + "-ta_filenameHL", {

  text : sFileNameLong,

  enabled : bEnabled,

  target : "_blank",

  href : oItem.getUrl()

}).addStyleClass("sapMUCFileName");

so, while you are not on 1.28 you can do a trick


  oUploadCollection.addDelegate({

            onAfterRendering: function () {

              $( ".sapMUCFileName" ).attr("target", "_blank");

             }

  });

like here JS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...

Former Member
0 Kudos

Hi Maksim,

Thank you for your quick reply. Your solution works perfect. My issue is solved.

Thank you,

Michael Visser

Answers (0)