TYPO3 backend modul DataTable is no function

前端 未结 1 1444
青春惊慌失措
青春惊慌失措 2021-01-28 17:19

I including in my extbase backend modul different assets in the Layout html. To init multiple DataTables:

$(dataTables[i]).DataTable(dataTableOptions);


        
相关标签:
1条回答
  • 2021-01-28 17:53

    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.

    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]});
    

    The namespace 'TYPO3/CMS/MyExtension/jquery-ui-widgets' map to the Path: 'EXT:my_extension/Resources/Public/JavaScript/jquery-ui-widgets.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'
            }"
    
    0 讨论(0)
提交回复
热议问题