1

I haven't had experience with JS Link and thought it would be a good idea to start learning it and try it out. I found what I thought were pretty straightforward tutorials of how to use it. First I tried using these examples, specifically the Priority Coloring and Percent Complete.

The first time around when I tried adding the JS Link file, my page turned white and stayed white. I haven't found a solution to that yet besides deleting the view and creating a new one. I tried doing this again and it seemed to have a successful connection as the completed checkbox in my task list changed from an actual checkbox to 'No'. But the color of my priority fields didn't change.

I tried doing this in a different site to see if that made a difference and didn't notice anything. I had similar results with the Percent Complete script. I was initially placing these scripts in my Site Assets library and then tried placing them in the masterpage library like I found in another tutorial video.

I would just like to successfully get a JS Link file to work on my list and then go from there. Has anyone come across these issues or know what I need to do to fix them?

3
  • I don't know what the trouble you are having. I did this tutorial here and got it to work.
    – Rothrock
    Nov 18, 2014 at 21:27
  • How are you attaching the JSLink? I find WebPart properties unreliable. You need to use Powershell to attach to the view itself Nov 18, 2014 at 22:59
  • for me, none of previous solutions was working. But when I changed the javascript file name, it works, but when I changed the content of the file and uploaded it again, none of changes was executed. It worked only if I changed the JavaScript file name again and again and...
    – user68822
    Jul 19, 2017 at 13:39

2 Answers 2

2

I got this to work. I had to use ~sitecollection/ to start the path in the JS Link field. I wasn't using ~sitecollection/ before and was just using the path that I would generally use (http://www.contoso.com/mysite/SiteAssets/filename.js). I don't quite understand why it works this way but this is what fixed my problem.

Here's the article that helped me figure this out.

https://social.msdn.microsoft.com/Forums/office/en-US/72e88ca7-af70-4769-9530-4b37d9b8c1d0/js-style-is-not-working-in-sharepoint-2013?forum=sharepointcustomization

2

I also solved this issue by using a URL beginning with ~site/ instead of ~sitecollection/, so it may be the case that any relative URL is accepted by SharePoint.

1
  • 2
    you need to use one of the accepted tokens in the beggining. Any other relative URL and it won't work. I think they are: ~site, ~sitecollection, ~sitelayouts and ~sitecollectionlayouts
    – Choggo
    Jan 19, 2015 at 1:59

Your Answer

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

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