0

I have a JSLink file to customise an external list and list items.

context.Templates.Fields["VM_NAME"] = { "View": VmNameRenderCallback };
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(context);

It works fine, but only after you clicked to view a list item then clicked "CLOSE" from the list item page, (or you create a new item, then click the cancel button from the create new item page)

All the customisations are lost, I can see the JSlink file is loaded, but doesn't look like it's being executed (I've put debugger in there, but it doesn't break at the break point)

I'm thinking it might be something to do with caching? But where can I find setting about caching in SP? (I'm on SP 2013 foundation)

Or it's something else?

Thanks!

2 Answers 2

0

Is Minimal Download Strategy feature activated? If yes, deactivate feature and try again.

0
1

Or... don't disable it, fix your code. To make your code work with MDS you should register your script for MDS. Meaning, you should put all your code inside a function with no parameters that MDS can execute when the page is loaded.

Sound complicated? It's not really.. it is one line of JS:

RegisterModuleInit("[JS file URL]", [function name to call on page load]);

That said, yes - I agree this whole MDS is very complicated and creates a lot of issues.

Good luck!

2
  • Hi Shai, Thanks for the reply! I'm a bit confused, I'm very new to SP, would you be able to provide me a sample code or something.. I'm just not sure where to start... thanks!!
    – Kris
    Jan 14, 2014 at 22:44
  • Is there anyway to use RegisterModuleInit on the javascript in the head tag? Not in file.. Code is present in script tags in head
    – variable
    Apr 8, 2014 at 5:31

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.