Bug #68891
closedLoading JavaScript libraries in Backend
0%
Description
I have the following - trying to use jQuery UI Sortable:
<f:be.container includeRequireJsModules="{0: 'TYPO3/CMS/Backend/Modal', 1: 'TYPO3/CMS/Core/Contrib/jquery-ui/core', 2: 'TYPO3/CMS/Core/Contrib/jquery-ui/sortable'}" loadJQuery="true" includeCssFiles="{0: '{f:uri.resource(path:\'Stylesheet/backend.css\')}'}" includeJsFiles="{0: '{f:uri.resource(path:\'Javascript/javascript.js\')}'}" > <div class="typo3-fullDoc"> ... </div> </f:be.container>
My problem is that my local javascript.js is loaded before the jQuery UI core and Sortable and then I get javascript errors when trying to access jQuery('#element').sortable();
The haed of source code is:
<head> <link rel="stylesheet" type="text/css" href="../typo3temp/sprites/zextensions.css?1439144400" media="all"> <link rel="stylesheet" type="text/css" href="sysext/core/Resources/Public/Css/flags.css?1438694064" media="all"> <link rel="stylesheet" type="text/css" href="sysext/t3skin/stylesheets/sprites/t3skin.css?1438694065" media="all"> <link rel="stylesheet" type="text/css" href="sysext/t3skin/Resources/Public/Css/backend.css?1438694065" media="all"> <link rel="stylesheet" type="text/css" href="../typo3conf/ext/tc_sys/Resources/Private/Backend/Stylesheet/stylesheet.css?1438371387" media="all"> <link rel="stylesheet" type="text/css" href="../typo3conf/ext/tc_sys/Resources/Public/Stylesheet/backend.css?1439143482" media="all"> .... <script src="sysext/core/Resources/Public/JavaScript/Contrib/require.js" type="text/javascript"></script> .... <script src="../typo3conf/ext/tc_sys/Resources/Public/Javascript/javascript.js?1439149239" type="text/javascript"></script> <script src="sysext/core/Resources/Public/JavaScript/Contrib/bootstrap/bootstrap.js?1438694064" type="text/javascript"></script> <script type="text/javascript"> /*RequireJS-Module-TYPO3/CMS/Backend/LegacyCssClasses*/ require(["TYPO3/CMS/Backend/LegacyCssClasses"]); /*RequireJS-Module-TYPO3/CMS/Backend/ClickMenu*/ require(["TYPO3/CMS/Backend/ClickMenu"]); /*RequireJS-Module-TYPO3/CMS/Backend/Modal*/ require(["TYPO3/CMS/Backend/Modal"]); /*RequireJS-Module-TYPO3/CMS/Core/Contrib/jquery-ui/core*/ require(["TYPO3/CMS/Core/Contrib/jquery-ui/core"]); /*RequireJS-Module-TYPO3/CMS/Core/Contrib/jquery-ui/sortable*/ require(["TYPO3/CMS/Core/Contrib/jquery-ui/sortable"]); .... </script> </head>
In my eyes this configuration makes it impossible to access the Contrib libraries - maybe I have done something wrong?
Updated by Wouter Wolters about 9 years ago
- Status changed from New to Closed
- Assignee deleted (
Benni Mack)
Hey Claus, this is more a question and not a bug report.
I suggest to join our Slack channel and ask your question there.
Join slack here: https://forger.typo3.org/slack
I can help you there with your issue.
Closing this ticket now.
Updated by Benni Mack about 9 years ago
If you want to get this solved,
either a) write a AMD module and require jQuery UI sortable ("require(['jqueryui/sortable'|, function() ... ")
or b) include jquery.sortable with a simple <script> tag manually as well, loading it twice, but making the code available in global scope.