I have the folloing definition in my schema.xml

 <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" 
            DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" 
        <Toolbar Type="Standard" />
        <XslLink Default="TRUE">main.xsl</XslLink>
        <RowLimit Paged="TRUE">30</RowLimit>
          <FieldRef Name="Nr" />
          <FieldRef Name="LinkTitle" />

The references skript includes the following:

(function () {

    // Create object that have the context information about the field that we want to change it's output render  
    var bodyFiledContext = {};
    bodyFiledContext.Templates = {};
    bodyFiledContext.Templates.Fields = {
        // Apply the new rendering for Body field on list view 
        "Nr": {
            "View": FormatToString
        "Auflage": {
            "View": FormatToString
        "Erscheinugsjahr": {
            "View": FormatToString
        "DoWarning": {
            "View": DisplayWarningbutton


function DisplayWarningbutton(ctx) {
    var bodyValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    var url = _spPageContextInfo.siteAbsoluteUrl; 
    url = url + "/_layouts/15/BookManagement/DoWarning.aspx?ID=" + ctx.CurrentItem.ID + "&List=" + ctx.listName + "&TemplateID=b336e092-4722-442d-b189-5c0ca3a65888";
    return "<a href='" + url + "' >Klick me</span>";

// This function provides the rendering logic 
function FormatToString(ctx) {

    var bodyValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    bodyValue = bodyValue.replace(".", "");
    return "<span >" + bodyValue + "</span>";


Now when my page loads and I go to the specified View, the JSLink script will not be executed. When I reload the Page by pressing F5, the script will be executed.

Is there a detail what I am do wrong?


I guest your site has MDS feature (a.k.a Minimal Download Strategy) enabled (that is enabled by default), which causes this behavior. When you navigate to view directly not all JavaScript is runned and only MDS registered modules is executed. On the other hand, when you press F5, whole page is reloaded and all JS files are executed.

To solve this you have two options:

  1. Disable MDS feature on the site. It is probably the easiest and fasted solution.
  2. Register your script to execute as MDS module. Here is very amazing solution, that works very well: Register CSR-override on MDS enabled SharePoint 2013 site.
  • thx alot This helped me. – Sascha Oct 30 '15 at 18:14

I see the question is some years old, but I'd like to shere two nice CSR tutorials anyway:

  1. About ListViews
  2. About ListForms

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.