1

In our team we have a convention that common use js libraries, for example jQuery, are registered somehow in website, so in custom web parts we shouldn't register it again.

In one website jQuery is registered with CustomAction like described http://johnliu.net/blog/2015/12/the-safest-future-proof-way-to-brand-your-sharepoint-and-sharepoint-online

And the custom web part have other library jQuery UI registered with ScripLink control

<SharePoint:ScriptLink ID="jQueryUI" runat="server" Name="/_layouts/15/AM/Scripts/jquery-ui-1.11.4.js" Localizable="False" Language="text/javascript"></SharePoint:ScriptLink>

In result the page is rendered with wrong order of script tags

<script type="text/javascript" src="/_layouts/15/am/scripts/jquery-ui-1.11.4.js"></script>
<script type="text/javascript" src="/boardnet/siteassets/jquery/jquery-3.1.1.min.js"></script>

Script added with CustomAction is always after script added with ScriptLink control. Even if I tried 1 as Sequence of CustomAction, but I didn't tried a negative value as solution above doesn't allow it. But I need reverse order to have jQuery UI works properly.

So the question is: how is it possible to specify order for script added with CustomAction and ScriptLink control?

1

You control the order of UserCustomAction ScriptLinks by setting the Sequence nr.

And yes, Scriptlinks defined in the ASPX code are executed before UserCustomAction Scriptlinks.
You can't change that default order, so load jQuery from ASPX or load both scripts as UserCustomAction.

Forgot about Johns method of adding UserCustomActions..
they require adding ASPX pages for every SiteCollection

Instead, use the Chrome Extension SPEditor Tomi Tavela wrote:

It is easier to use and does much much more

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.