1

Is it possible to change the "Link to item" URL on a Title column with out of the box solutions? I currently have a list web part which has a data connection to another list web part on the page. Currently to select the item so it opens in the connected web part I need to click on the rbunsel.gif icon and looks to go to the following location:

<a onclick="SelectField('{5FF90AEA-718A-4142-856A-628FE69D9A54}','20');return false;" href="javascript:SelectField('{5FF90AEA-718A-4142-856A-628FE69D9A54}','20');return false;" target="_self"><img align="absmiddle" alt="Normal" src="/_layouts/15/images/rbunsel.gif?rev=23" border="0"></a>

However, if I click on the Title item, it currently opens the edit form for the record in a dialog window. Is it possible to change this so the Title "link to item" will connect to the connected web part instead?

Thanks.

  • I don`t see any out of the box settings. I do change this title link URL using JSLink which is flexible for customization but it requires coding. Is it something you are interested in? – Venkat Konjeti Jun 2 '17 at 19:19
  • yes, I can do a jslink solution if that's preferred. Thanks. – cycloxr Jun 2 '17 at 19:21
0

I am not sure about what url you are going to replace for title link but you can refer below code for your scenario

//Custom View

(function () {

    var requestCtx = {};
    requestCtx.Templates = {};

    requestCtx.Templates.Fields = {
        'LinkTitle': {'View': titleFieldTemplate}   
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(requestCtx);

})();

function titleFieldTemplate(ctx) {
    var id = ctx.CurrentItem.ID;
    var title = ctx.CurrentItem.Title;
    var url = "https://abc.sharepoint.com/pages/custompage.aspx?itemId=" + id;
    return '<a href="' + url + '">' + title + '</a>';
}

Here are the steps how you can use

  1. Create a JavaScript file with your logic and place into one of the library (I place always in Style Library).
  2. Go to the list view web part page.
  3. Edit web part.
  4. You will find an option "JS Link" under "Misc.." section.
  5. You need to refer the path in the textbox. if you have file in site collection library the path should be ~sitecollection/Style Library/libraryname/jslinkfile.js. If it is in site path syntax should be ~site/libraryname/Scripts/jslinkfile.js.

If you are new to JS Link go through below link for articles.

Client-Side Rendering/JS Link documentation?

| improve this answer | |
  • Would I just replace the url as the following to open in the connected web part? var url = "javascript:SelectField('{5FF90AEA-718A-4142-856A-628FE69D9A54}','" + id + "')"; – cycloxr Jun 2 '17 at 20:43
  • Yes. What ever you want to execute just replace with that. – Venkat Konjeti Jun 2 '17 at 21:16
0

Instead of adding a JSLink on each and every WebPart

You can add a Calculated Column set to datatype=Number

="<a href='#' onclick=""{PreventDefaultNavigation();"
&"var ID=getItemIDFromIID(findIIDInAncestorNode(this));"
&"SelectField('{5FF90AEA-718A-4142-856A-628FE69D9A54}',ID);"
&"}""><img src='/_layouts/15/images/rbunsel.gif?rev=23' width='20px'></a>"

This will add the Link to everywhere the Calculated Column is displayed in Views

But do read the Pros & Cons: http://www.viewmaster365.com/#/How

This works down to SP2010 (CSR/JSLink is SP2013)

But no longer in Modern Experiences (and neither will CSR/JSLink)

| improve this answer | |
  • Danny, Thanks. It doesn't seem to do anything however when I click on the link that it creates. Also, am I able to display the title instead of the rbunsel image? – cycloxr Jun 4 '17 at 2:30
  • There was one more or less obvious typo in the code. Your answer tells me you do not have medior HTML & Javascrpt skills, is that correct? The img is wrapped in an a tag – Danny '365CSI' Engelman Jun 4 '17 at 7:21
  • I understand that, tried replacing the img tag with the column. I'm no developer but know enough to get me by. – cycloxr Jun 4 '17 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.