diff --git a/templates/base/components/datatable/layout.ready.js.twig b/templates/base/components/datatable/layout.ready.js.twig index ef8ad8f7a..3bf7bfc35 100644 --- a/templates/base/components/datatable/layout.ready.js.twig +++ b/templates/base/components/datatable/layout.ready.js.twig @@ -41,8 +41,8 @@ var oTable{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ }, scrollX: true, {% if oUIBlock.GetOption('sMaxHeight') is not empty %} - scrollY: {{ oUIBlock.GetOption('sMaxHeight') }}, - scrollCollapse: true, + scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}", + scrollCollapse: true, {% endif %} lengthMenu: [[ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, -1], [ {{ iPageSize }}, {{ iPageSize*2 }}, {{ iPageSize*3 }}, {{ iPageSize*4 }}, "{{ 'UI:Datatables:Language:DisplayLength:All'|dict_s }}"]], dom: "<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>t<'ibo-datatable--toolbar'<'ibo-datatable--toolbar-left' pl><'ibo-datatable--toolbar-right' i>>", diff --git a/templates/base/components/datatable/static/formtable/layout.ready.js.twig b/templates/base/components/datatable/static/formtable/layout.ready.js.twig index 005c759b5..9429451cd 100644 --- a/templates/base/components/datatable/static/formtable/layout.ready.js.twig +++ b/templates/base/components/datatable/static/formtable/layout.ready.js.twig @@ -7,9 +7,6 @@ var table{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ }, scrollX: true, scrollCollapse: true, - {% if oUIBlock.GetOption('sMaxHeight') is not empty %} - scrollY: {{ oUIBlock.GetOption('sMaxHeight') }}, - {% endif %} paging: false, filter: false, autoWidth: false, @@ -29,34 +26,27 @@ var table{{ sListIDForVarSuffix }} = $('#{{ oUIBlock.GetId() }}').DataTable({ {% endif %} drawCallback: function () { // Hiding pagination if only one page - if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) - { + if ($(this).closest('.dataTables_wrapper').find('.dataTables_paginate:last .paginate_button:not(.previous):not(.next)').length < 2) { $(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').hide(); - } - else - { + } else { $(this).closest('.dataTables_wrapper').find('.dataTables_paginate, .dataTables_info').show(); } }, - createdRow: function (row, data, dataIndex) { - if (data['@class'] !== undefined) - { + createdRow: function( row, data, dataIndex ) { + if (data['@class'] !== undefined) { $(row).addClass(data['@class']); } }, }); - -if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible')) -{ +if ($('#{{ oUIBlock.GetId() }}').find('thead').is(':visible')) { table{{ sListIDForVarSuffix }}.columns.adjust().draw(); } -if (window.ResizeObserver) -{ +if(window.ResizeObserver){ let oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = null; - const oFromTable{{ sListIDForVarSuffix }}Resize = new ResizeObserver(function () { + const oFromTable{{ sListIDForVarSuffix }}Resize = new ResizeObserver(function(){ clearTimeout(oFromTable{{ sListIDForVarSuffix }}ResizeTimeout); - oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = setTimeout(function () { + oFromTable{{ sListIDForVarSuffix }}ResizeTimeout = setTimeout(function(){ $('#{{ oUIBlock.GetId() }}').DataTable().columns.adjust(); }, 120); }); diff --git a/templates/base/components/datatable/static/layout.ready.js.twig b/templates/base/components/datatable/static/layout.ready.js.twig index e571cfbcc..49cc18a37 100644 --- a/templates/base/components/datatable/static/layout.ready.js.twig +++ b/templates/base/components/datatable/static/layout.ready.js.twig @@ -31,8 +31,8 @@ $('#{{ oUIBlock.GetId() }}').DataTable({ }, scrollX: true, {% if oUIBlock.GetOption('sMaxHeight') is not empty %} - scrollY: {{ oUIBlock.GetOption('sMaxHeight') }}, - scrollCollapse: true, + scrollY: "{{ oUIBlock.GetOption('sMaxHeight') }}", + scrollCollapse: true, {% endif %} order: [], autoWidth: false,