OnChange 事件在 magento 2 中不起作用

问题描述 投票:0回答:0

我必须使下拉菜单可搜索,其中下拉选项将基于用户输入我必须使用 jquery 来触发搜索功能,每当用户在下拉搜索菜单中键入任何字母时。但问题是 onChange 函数没有被触发。

这是调用 custom-ui-select-p-v 的 magento php 代码

"cppv"=>['ppv' => [
                'arguments' => [
                    'data' => [
                        'config' => [
                            'componentType' => Form\Field::NAME,
                            'component' => 'Woohoo_Catalog/js/components/attr-custom-ui-select-p-v',
                            'elementTmpl' => 'ui/grid/filters/elements/ui-select',
                            'formElement' => Form\Element\Select::NAME,
                            'multiple' => false,
                            'filterOptions' => true,
                            'dataScope' => 'ppv',
                            'searchOptions' => true,
                            'disableLabel' => true,
                            'dataUrl' => $this->urlInterface->getUrl('wc/attribute/phy'),
                        ]
                    ]
                ]]],`



this is the js file



define([
    'Magento_Ui/js/form/element/ui-select',
    'jquery',
    'underscore',
    'uiRegistry'
    ], function (Select, $, _, uiRegistry) {
     return Select.extend({

    onChange:function (currentValue){
        console.log("clicked");
    }});
 });


I just want the onchange to work whenever i am pressing any key 
php jquery magento magento2
© www.soinside.com 2019 - 2024. All rights reserved.