6

I have read many articles about client side rendering & JSLINKs but i am unable to differentiate between these two topics. now I have used JSLINK to implement 2 things inside my SharePoint server:-

  1. I wanted to prevent users from editing a site column inside the Quick Edit grid. and to achieve this i created a JavaScript file, which mainly disable the column inside the quick edit (AllowGridEditing = false), then i define the javascript file to be the JSLINK for the site column using powershell code .

    $web = Get-SPWeb http://*****
    $field = $web.Fields["Item Number"]
    $field.JSLink = "~siteCollection/Style Library/JS/HideItemNumberInQuickEdit.js"
    $field.update($true)
    
  2. I also used JSLINK to create a non-standard list view, where i define a javascript which render the view, and I link the list view's JSLINK with the javascript.

so I am a bit confused if JSLINK is a sub topic under client side rendering? or client side rendering in SharePoint 2013, means creating JSLINKs for site columns, list views etc.?

  • 2
    JSLink is just what it says; a link to a JavaScript file. It does not have to be a JS file with Client Side Rendering code, can be any JS file. On Office365/SP Online JSLink can link to external JS files. OnPrem you can only link to JS files within your domain (~sitecollection and ~site tokens) So it is also a perfectly valid mechanism to add jQuery to a Form or View page. Check out the JSLinkManager I wrote as support tool for the iCSR Library – Danny '365CSI' Engelman Mar 4 '16 at 16:19
  • 1
    Note: SP converts all JSLinks to lowercase, because SP runs on IIS that is no problem. If you use external links hosted on other then IIS lowercase and UPPERCASE does matter (so you can only link to lowercased urls) – Danny '365CSI' Engelman Mar 5 '16 at 10:03
15

Client-Side Rendering is simply a term for when the data is transformed using the client rather than the server. This means using client-side technologies, such as HTML and JavaScript. It allows us to style SharePoint elements using JavaScript, rather than having to write XSLT. You can use it to style complete List Views, Fields, Search Results and more. This makes it a lot simpler and more intuitive, especially for web developers who haven’t used SharePoint before.

When talking about Client Side Rendering in SharePoint, there are really 2 mechanisms: search Display Templates, and JSLink.

So JSLink is nothing but one of the mechanisms in Client Side Rendering. It is a property available on many SharePoint objects, including Fields, Lists, Views, and Content Types. In its simplest form, the JSLink property simply adds a JavaScript file to the page. Depending on the JavaScript, this could then do anything – either related to the object of which it was attached, or something completely irrelevant if desired.

This is an excellent blog which I referenced about Introduction to Client-Side Rendering in SharePoint 2013.

  • so JSLINK is one method to implement client side rendering.. – john Gu Mar 3 '16 at 12:26
  • 2
    Yes that's correct. – Asad Refai Mar 3 '16 at 12:26
  • 1
    well said @Asad – Mike Jun 16 '17 at 19:58

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.