From 989ba7bbe7115fd52e92b29666d11be68d1d4270 Mon Sep 17 00:00:00 2001 From: Benjamin Dalsass <95754414+bdalsass@users.noreply.github.com> Date: Thu, 4 Jul 2024 07:53:56 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07615=20-=20Edition=20of=20a=20n-n=20link?= =?UTF-8?q?=20in=20edit=20mode=20not=20working=20-=20Register=20input=20li?= =?UTF-8?q?steners=20on=20page=20ready?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Indirect/BlockIndirectLinkSetEditTable.php | 17 +++++++++-------- .../layout.ready.js.twig | 5 +++++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 templates/application/links/indirect/block-indirect-linkset-edit-table/layout.ready.js.twig diff --git a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php index a5854f8bb..85187862b 100644 --- a/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php +++ b/sources/Application/UI/Links/Indirect/BlockIndirectLinkSetEditTable.php @@ -37,6 +37,7 @@ class BlockIndirectLinkSetEditTable extends UIContentBlock // Overloaded constants public const BLOCK_CODE = 'ibo-block-indirect-linkset-edit-table'; public const DEFAULT_JS_TEMPLATE_REL_PATH = 'application/links/indirect/block-indirect-linkset-edit-table/layout'; + public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'application/links/indirect/block-indirect-linkset-edit-table/layout'; public const DEFAULT_JS_FILES_REL_PATH = [ 'js/links/links_widget.js', ]; @@ -327,20 +328,20 @@ EOF if ($iUniqueId > 0) { // Rows created with ajax call need OnLinkAdded call. // - $oP->add_ready_script( - <<add_ready_script( + <<oUILinksWidget->GetInputId()}.OnLinkAdded($iUniqueId, $iRemoteObjKey); EOF - ); + ); } else { // Rows added before loading the form don't have to call OnLinkAdded. // Listeners are already present and DOM is not recreated $iPositiveUniqueId = -$iUniqueId; - $oP->add_ready_script(<<add_ready_script(<<oUILinksWidget->GetInputId()}.AddLink($iPositiveUniqueId, $iRemoteObjKey); EOF - ); + ); } foreach ($this->oUILinksWidget->GetEditableFields() as $sFieldCode) { @@ -352,11 +353,11 @@ EOF $aFieldsMap[$sFieldCode] = $sSafeFieldId; $sValue = $oNewLinkObj->Get($sFieldCode); - $oP->add_ready_script( - <<add_ready_script( + <<oUILinksWidget->GetInputId()}.OnValueChange($iKey, $iUniqueId, '$sFieldCode', '$sValue'); JS - ); + ); } $sState = ''; diff --git a/templates/application/links/indirect/block-indirect-linkset-edit-table/layout.ready.js.twig b/templates/application/links/indirect/block-indirect-linkset-edit-table/layout.ready.js.twig new file mode 100644 index 000000000..f52b3cd6c --- /dev/null +++ b/templates/application/links/indirect/block-indirect-linkset-edit-table/layout.ready.js.twig @@ -0,0 +1,5 @@ +{# @copyright Copyright (C) 2010-2024 Combodo SAS #} +{# @license http://opensource.org/licenses/AGPL-3.0 #} +{% apply spaceless %} +oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.RegisterChange(); +{% endapply %} \ No newline at end of file