JSlink not applying on list view web part! Where to store? How to correctly refer to it?

Iron Contributor

We have a customers list and on one page we have added the list view webpart.

The list is shown with the name and other columns.

We have a javascript display template (JSlink).

 

We have stored the javascript here "Style Library / Custom / ags_ovr_cloud.js". Is that a good location?

In the list view web part, in the JSlink field, how do we reference the javascript?

 

Kind regards, John

 

5 Replies
This location is good or you could think to store in the master page gallery of your site. In regards of how to reference the JavaScript file, the ListViewWebPart has a property where you can specify the Url path of the JavaScript path

Thanks Juan

We will then keep that location for the javascript files.

But how exactly are the javascript files in that location to be referenced from inside the JSlink entry field?

Enjoy, John

• When referencing the JS file in the JS Link field in the Web Part properties you need to use the ~sitecollection token: 
~sitecollection/Library/jslink.js
~sitecollection/site/Library/jslink.js

Thanks to Juan and Brent

Together you provided the answer:

1) The location "Style Library / Custom /" is a good place for storing JSlink.js files.

2) The JS Link property is then filled as "~sitecollection/Style Library/Custom/JSlink.js".

 

The above now lets me see the changed display of the list items.

Thanks again, John