0

So I know you can use JSLink to include JavaScript files in list definitions in Schema.xml like so:

<Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" JSLink="~site/SiteAssets/Scripts/jquery-1.11.1.min.js" />

But how can I do this with a list instance that I'm provisioning that's based on the tasks list definition? Is there somewhere I can include JSLink in the instance's Elements.xml?

1

If you would have your own custom list definition, you could deploy a custom form for your list instance, and set the JSLink element of the Form. You cannot set it "globally" for the list, only per form.

If your list instance is based on a built-in list instance (like Tasks in your case) you should set the JSLink property from code. If you would like to deploy the list instance and set the JSLink property from a .wsp package, you should lookup the list form and set this property from a feature receiver. If you already created / deployed the list instance, the simplest method is to set the property via PowerShell. See the code samples for PowerShell and C# in this thread.

1
  • Perfect - adding JSLink in feature receiver code worked a treat. Thank you!
    – Submits
    Dec 12 '14 at 15:46

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.