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