locked
Open Document in a new tab/window RRS feed

  • Question

  • Hi There,

    I have a requirement to open documents in document library in a new tab or new window using a column with value as "---->" when clicked upon that arrow document should open in a new tab/window, can you please help me out on how to achieve this functionality. I am working in SharePoint 2013 online (Office 365).

    Thanks and Regards,


    Raj Kamal Singh Rathore


    Wednesday, January 7, 2015 9:48 AM

Answers

  • Hi,

    According to your description, you might want to open documents in a new tab when clicking a column in your document library.

    As there is no such OOTB feature can meet your requirement, custom code would be needed.

    In SharePoint 2013, Client Side Rendering(JSLink) is introduced to help to define or modify the rendering logic of SharePoint List views, you can add a column to display the “---->”, then use JSLink to modify the HTML structure of it to make it clickable and open the specific document in a new tab.

    The link below with a demo about how to change the HTML structure of a field in a list for your reference:

    http://www.idubbs.com/blog/2012/js-link-for-sharepoint-2013-web-partsa-quick-functional-primer/

    For opening in a new tab, we can set the <a> tag target attribute as “_blank”:

    http://www.w3schools.com/tags/att_a_target.asp

    Best regards


    Patrick Liang
    TechNet Community Support

    Thursday, January 8, 2015 1:29 AM
  • I have followed the solution using JSLink in the webpart, we can write our JavaScript just to change the View not the value, Thanks to Patricks Link.

    this URL shows the step by step procedure 

    http://www.abelsolutions.com/2013-blog/creating-a-simple-kpi-column-in-sharepoint-2013-list-views-using-js-link/ 

    Thanks and Regards


    Raj Kamal Singh Rathore


    Monday, January 19, 2015 6:48 AM

All replies

  • Hi,

    According to your description, you might want to open documents in a new tab when clicking a column in your document library.

    As there is no such OOTB feature can meet your requirement, custom code would be needed.

    In SharePoint 2013, Client Side Rendering(JSLink) is introduced to help to define or modify the rendering logic of SharePoint List views, you can add a column to display the “---->”, then use JSLink to modify the HTML structure of it to make it clickable and open the specific document in a new tab.

    The link below with a demo about how to change the HTML structure of a field in a list for your reference:

    http://www.idubbs.com/blog/2012/js-link-for-sharepoint-2013-web-partsa-quick-functional-primer/

    For opening in a new tab, we can set the <a> tag target attribute as “_blank”:

    http://www.w3schools.com/tags/att_a_target.asp

    Best regards


    Patrick Liang
    TechNet Community Support

    Thursday, January 8, 2015 1:29 AM
  • Hi Patrick,

    Thanks for your reply, there is a small change I need to insert a image something like representing an arrow before or after the title column values, indicating that the documents will be opened in a new tab/window when clicked on Title column values.

    For documents to open in a new window I have written a JavaScript and its working fine I need a way to append the image to the title values.

    Thanks and Regards,

    Raj Kamal Singh Rathore.


    Raj Kamal Singh Rathore

    Tuesday, January 13, 2015 10:36 AM
  • I have followed the solution using JSLink in the webpart, we can write our JavaScript just to change the View not the value, Thanks to Patricks Link.

    this URL shows the step by step procedure 

    http://www.abelsolutions.com/2013-blog/creating-a-simple-kpi-column-in-sharepoint-2013-list-views-using-js-link/ 

    Thanks and Regards


    Raj Kamal Singh Rathore


    Monday, January 19, 2015 6:48 AM