diff --git a/src/UI/Component/Input/Field/FilterInput.php b/src/UI/Component/Input/Field/FilterInput.php new file mode 100644 index 000000000000..21951127afb6 --- /dev/null +++ b/src/UI/Component/Input/Field/FilterInput.php @@ -0,0 +1,33 @@ +checkArgListElements("input", $inputs, $classes); // @todo: how to manage this dependency? diff --git a/src/UI/Implementation/Component/Input/Field/FilterContextRenderer.php b/src/UI/Implementation/Component/Input/Field/FilterContextRenderer.php index 7129982c96fd..7cd9335ef563 100644 --- a/src/UI/Implementation/Component/Input/Field/FilterContextRenderer.php +++ b/src/UI/Implementation/Component/Input/Field/FilterContextRenderer.php @@ -188,12 +188,7 @@ protected function renderInputField(Template $tpl, Input $input) { $tpl->parseCurrentBlock(); } - $input = $input->withAdditionalOnLoadCode(function ($id) { - $code = "$('#$id').on('input', function(event) { - il.UI.filter.handleChange(event, '$id', $('#$id').val()); - });"; - return $code; - }); + $input = $input->withAdditionalOnLoadCode($input->getUpdateOnLoadCode()); $this->maybeRenderId($input, $tpl); break; } diff --git a/src/UI/Implementation/Component/Input/Field/Text.php b/src/UI/Implementation/Component/Input/Field/Text.php index 49529f565fad..ee683e82fb4f 100644 --- a/src/UI/Implementation/Component/Input/Field/Text.php +++ b/src/UI/Implementation/Component/Input/Field/Text.php @@ -29,4 +29,17 @@ protected function isClientSideValueOk($value) { protected function getConstraintForRequirement() { return $this->validation_factory->hasMinLength(1); } + + /** + * @inheritdoc + */ + public function getUpdateOnLoadCode(): \Closure + { + return function ($id) { + $code = "$('#$id').on('input', function(event) { + il.UI.filter.handleChange(event, '$id', $('#$id').val()); + });"; + return $code; + }; + } }