Pages

Showing posts with label SharePoint 2013 JSLink Not working on LinkTitle Column. Show all posts
Showing posts with label SharePoint 2013 JSLink Not working on LinkTitle Column. Show all posts

Tuesday, May 20, 2014

SharePoint 2013 JSLink Not working on LinkTitle Column - Workaround Solution

When I applied JSlink for LinkTitle Column I am not able to see the JS is loading at all. But all for other Columns and my custom columns too I can apply.
Is their any difference over here..Yes it is..The workaround for this is
Below is demonstrated how to customize LinkTitle column rendering
1) Create template
(function () {


   function titleRenderer(ctx) {
       var item = ctx.CurrentItem;
       return '<img src="/SiteAssets/' +  item.Title + '.png" />';  
    }



    function registerRenderer()
    {
      var context = {};
      context.Templates = {};
      context.Templates.Fields = {
        "LinkTitle": {
            "View": titleRenderer
        }
      };

      SPClientTemplates.TemplateManager.RegisterTemplateOverrides(context);
    } 
    ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');

})();
where we override LinkTitle field rendering
2) Upload template file into, for example, Site Assets library
3) Specify JS Link property for List View web part Example: ~site/SiteAssets/Phones.js

Sameway if you see issues in any of the below fields please follow with above way,
 //ID,PermMask,FSObjType,HTML_x0020_File_x0020_Type,ContentType,File_x0020_Type,
 //File_x0020_Type.mapapp,HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon,
 //HTML_x0020_File_x0020_Type.File_x0020_Type.mapico,serverurl.progid,
 //ServerRedirectedEmbedUrl,File_x0020_Type.progid,File_x0020_Type.url,
 //FileRef,FileLeafRef,CheckoutUser,CheckedOutUserId,IsCheckedoutToLocal,Title,
 //Created,Created.FriendlyDisplay,firstRow