3

I am working on an on-premises sharepoint 2013. and i have a list view web part inside my team site. now i have two JSLINKS which i want to reference inside the web part JSLINK section.

The first JSLINK will disable the title field inside the quick edit grid as follow:-

(function () {
    var overrideContext = {};
    overrideContext.Templates = overrideContext.Templates || {};
    overrideContext.Templates.OnPreRender = function(ctx) {
        var statusField = ctx.ListSchema.Field.filter(function(f) {
            return f.Name === 'LinkTitle';
        });
        if (statusField.length>0) {
            statusField[0].AllowGridEditing = false;
        }
    }
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideContext);
})();

While the second JSLINK will color code the rows:-

SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {
       function init() {
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
          Templates: {},
          OnPostRender: function(ctx) {
           var statusColors =  {
              'Closed' : '#FFF1AD',  
              'Resolved' : '#FFD800',
              'Active' : '#01DF3A' 
           };

           var rows = ctx.ListData.Row;
           for (var i=0;i<rows.length;i++)
           {
             //code goes here
           }
            ctx.skipNextAnimation = true;
          },
        });
      }
      RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens("~siteCollection/Style Library/colorcode.js"), init);
      init();
    });

now if i reference each JSLINK separately inside the webpart>>JSLINK section i will get the desired results. but if i try to reference both JSLINKs inside the webpart>>JSLINK section as follow:-

~siteCollection/Style Library/colorcode.js;~siteCollection/Style Library/disabletitle.js

i will not get any results for the 2 JSLINKs .. so can anyone adivce how i can reference my above 2 jslinks inside the webpart??? again if i reference single JSLINKS i will get the desired results ..

6

Use a pipe between the two file paths:

~siteCollection/Style Library/colorcode.js|~siteCollection/Style Library/disabletitle.js

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.