3

I am trying to use JSLink+JavaScript to customize the rendering of a field. My very simple JavaScript code looks like this:

;(function () {
    'use strict';
    console.log('EmployeeFieldCSR loaded');

    var overrideCtx = {};
    overrideCtx.Templates = {};     
    overrideCtx.Templates.Fields = {
        'Employee': { 'View' : '<b><#=ctx.CurrentItem.Employee#></b>' }
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);       
})();

The field definition looks like this:

<Field
     ID="{b240270a-6204-4ac7-9b97-b74ca2e78a65}"
     Name="Employee"
     DisplayName="Employee"
     Type="Lookup"
     Indexed="TRUE"
     JSLink="~site/_layouts/15/CSRAssets/EmployeeFieldCSR.js"
     List="Lists/Contacts"
     ShowField="FullName"
     Required="FALSE"
     Group="Blueprint">
</Field>

I can get the custom rendering working fine (in the test code above it is very simple on purpose to hunt down the bug).

The problem is that when a user clicks on the callout menu (...) from FireFox (v19) or Chrome (v25), there is a script error and the callout menu does not show properly. It does appear correctly in Internet Explorer 10.

This is the error message that shows up in Chrome:

enter image description here

This is the error message that shows up in Firefox. Notice that there is a 401 unauthorize call in Firefox, i did not see one in Chrome.

enter image description here

And for good measure, this is how it looks and behaves (correctly) in Internet Explorer 10:

enter image description here

Is there something I need to do differently, or is this indeed an actual bug?

Best, Egil.

ps: would like to tag this with "JSLink" but I cannot due to lacking points :) pps: cross posted on http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/482639ba-ebbb-4ce5-99ce-aa3d5ae13d39

1
  • I am making my way through all the unanswered JavaScript questions, do you still require an answer as it looks like a JS Class registration problem in SharePoint + MDS issue + Chrome file caching issue all colliding. – Hugh Wood Dec 11 '13 at 14:16

Browse other questions tagged or ask your own question.