0

I have a picture library in SharePoint 2016 with the ratings enabled. I want users to be able to rate each picture in the library. In the display view, just the image icon shows and not the actual picture.

Users would have to click the icon to see the image and then hit the back button to rate the image. I want to show the image on the view so that there will be no drill down to see the picture. I created the below JS link to convert the icon to the image but I get an error that makes no sense.

The error I get in the console shows:

SCRIPT1006: Expected ')'

(funciton() {
    var nameFieldContext = {};
        nameFieldContext.Templates = {};
        nameFieldContext.Templates.Fields = {
            "Name": {"View": renderImageToRate }
        };
        SPClientTemplates.TemplateManager.RegisterTemplateOverrides(nameFieldContext);
})();  //<---- error points to this line

function renderImageToRate(ctx){
alert("In function");
    var name = ctx.CurrentItem.Name;
    
    return "<img src='../pictureLib/'"+name+">";
}

The code looks fine to me. Any ideas?

1 Answer 1

1

Your code looks fine to me as well. But I noted there is small syntax error in your code in 1st line.

You misspelled the function keyword. Try correcting it.

1
  • 1
    Thank you! It's always good to have a 2nd set of eyes
    – OLA
    Commented Dec 10, 2020 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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