问题描述
我在我的extbase后端中包含了html布局中的不同资产.要初始化多个数据表:
I including in my extbase backend modul different assets in the Layout html. To init multiple DataTables:
$(dataTables[i]).DataTable(dataTableOptions);
<f:be.container
enableClickMenu="false"
loadExtJs="false"
enableExtJsDebug="true"
>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/jquery-1.11.3.min.js')}"></script>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/jquery-ui.min.js')}"></script>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/jquery.dataTables.min.js')}"></script>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/moment.min.js')}"></script>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/jquery.multiselect.min.js')}"></script>
<script type="text/javascript" src="{f:uri.resource(path:'js/Backend/lib/jstree.min.js')}"></script>
但是在更新为TYPO3 7.6.15之后,总会有
But after Updating to TYPO3 7.6.15, there is always
错误.我尝试了不同的变体,但没有任何效果.我认为,问题将是后端模块中的jquery的noconflict版本.但是我不知道要解决这个问题.我希望你能帮助我
error. I tried different variations, but nothing works. I think, the problem will be the noconflict version of jquery in backend moduls. But i have no idea, to solve the problem. I hope you can help me
最佳团员丹尼尔
推荐答案
在苦苦挣扎之后,我用Typo3 requirejs表示法解决了我的问题.我认为,包括jQuery Typo3 noConflict标头将是问题,我不知道为什么Typo3不在自己的方法中使用她自己的名称空间.但我认为,将我自己的/旧式js库包含在requirejs中将是最佳做法.
Well, after struggeling around, i solved my problem with the Typo3 requirejs notation. I think, the jQuery Typo3 noConflict header including will be the problem and i don`t know, why Typo3 uses not her own namespace, for thier methods. But i think, to include all my own/legacy js-librariers over requirejs will be the best practice.
首先,在您的js文件中定义所有先决条件/依赖关系()(我的文件:在"EXT:my_extension/Resources/Public/JavaScript"中放置的BackendModule.js):
At first, define in your js file (my: BackendModule.js placed in 'EXT:my_extension/Resources/Public/JavaScript') all prerequisites/dependencies, that have to be include:
define([
'jquery',
'TYPO3/CMS/MyExtension/jquery-ui-widgets',
'moment',
'TYPO3/CMS/MyExtension/jquery.multiselect.min',
'datatables', ], function($, widgets, moment,multiselect) {[YOUR CODE]});
命名空间'TYPO3/CMS/MyExtension/jquery-ui-widgets'映射到路径:'EXT:my_extension/Resources/Public/JavaScript/jquery-ui-widgets.js'
The namespace 'TYPO3/CMS/MyExtension/jquery-ui-widgets' map to the Path: 'EXT:my_extension/Resources/Public/JavaScript/jquery-ui-widgets.js'
之后,我必须在模板中包含我的Js文件:
After that, i have to include my Js-File in the template:
<f:be.container
loadExtJsTheme="false"
enableExtJsDebug="false"
loadJQuery="false"
jQueryNamespace="defaultNoConflict"
includeRequireJsModules="{
0:'TYPO3/CMS/MyExtension/BackendModule'
}"
这篇关于TYPO3后端模块DataTable不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!