From 1281d475e4d80c20fd1ff472ae35faca0118231a Mon Sep 17 00:00:00 2001 From: acognet Date: Mon, 21 Jun 2021 16:50:19 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03912=20-=20Polishing:=20Export=20:=20fix?= =?UTF-8?q?=20date=20entry=20+=20size=20of=20datatable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/csvimport.php | 12 ++++--- .../static/formtable/layout.ready.js.twig | 32 ++++++++++++++----- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/pages/csvimport.php b/pages/csvimport.php index 6de52f6b6..92cd962ac 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -504,8 +504,6 @@ try { } $iUnchanged = count($aRes) - $iErrors - $iModified - $iCreated; - $oTable = DataTableUIBlockFactory::MakeForForm("csvImport", $aColumns, $aTableData); - $oContainer = UIContentBlockUIBlockFactory::MakeStandard(); $oContainer->AddCSSClass("wizContainer"); $oPage->AddSubBlock($oContainer); @@ -585,9 +583,12 @@ try { $oPanel = PanelUIBlockFactory::MakeNeutral(''); $oPanel->AddCSSClasses(['ibo-datatable-panel', 'mb-5']); + $oForm->AddSubBlock($oPanel); + + $oTable = DataTableUIBlockFactory::MakeForForm("csvImport", $aColumns, $aTableData); + $oTable->AddOption('bFullscreen', true); $oPanel->AddSubBlock($oTable); - $oForm->AddSubBlock($oPanel); if ($bSimulate) { $oForm->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Restart'))->SetOnClickJsCode("CSVRestart()")); @@ -1295,14 +1296,15 @@ EOF $sDefaultFormat = htmlentities((string)AttributeDateTime::GetFormat(), ENT_QUOTES, 'UTF-8'); $sExample = htmlentities(date((string)AttributeDateTime::GetFormat()), ENT_QUOTES, 'UTF-8'); - $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatDefault_Example', $sDefaultFormat, $sExample), "date_time_format", "default", "radio_date_time_std", "radio"); + $oRadioDefault = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('UI:CSVImport:DefaultDateTimeFormat_Format_Example', $sDefaultFormat, $sExample), "date_time_format", "default", "radio_date_time_std", "radio"); $oRadioDefault->GetInput()->SetIsChecked(($sDateTimeFormat == (string)AttributeDateTime::GetFormat())); $oRadioDefault->SetBeforeInput(false); $oRadioDefault->GetInput()->AddCSSClass('ibo-input-checkbox'); $oFieldSetDate->AddSubBlock($oRadioDefault); $oFieldSetDate->AddSubBlock(new Html('
')); - $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('Core:BulkExport:DateTimeFormatCustom_Format', $sDateTimeFormat), "date_time_format", "custom", "radio_date_time_custom", "radio"); + $sFormatInput = ''; + $oRadioCustom = InputUIBlockFactory::MakeForInputWithLabel(Dict::Format('UI:CSVImport:CustomDateTimeFormat', $sFormatInput), "date_time_format", "custom", "radio_date_time_custom", "radio"); $oRadioCustom->GetInput()->SetIsChecked($sDateTimeFormat !== (string)AttributeDateTime::GetFormat()); $oRadioCustom->SetBeforeInput(false); $oRadioCustom->GetInput()->AddCSSClass('ibo-input-checkbox'); 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 9429451cd..1c9dafee9 100644 --- a/templates/base/components/datatable/static/formtable/layout.ready.js.twig +++ b/templates/base/components/datatable/static/formtable/layout.ready.js.twig @@ -26,27 +26,43 @@ 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.GetOption('bFullscreen')) %} +var myheight = $("#ibo-main-content").height()-$("#ibo-main-content")[0].scrollHeight+$("#{{ oUIBlock.GetId() }}").height(); +if (myheight < 200) +{ + myheight = 200; +}; +$("#{{ oUIBlock.GetId() }}_wrapper").find(".dataTables_scrollBody").height(myheight); +{% endif %} + +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); });