Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
Uncaught ReferenceError: addAdresar is not defined at HTMLInputElement.onclick

I created a modal popup with grid columns. This works well, my data is loaded into the grid. In the action column, I added a button that calls the function. But an error is always displayed. Apparently my js code is misspelled. Can someone please explain to me how to call a function?

This is my action column, which I need call my custom function: Vendor/Module/Ui/Component/Listing/Column/Action.php

public function prepareDataSource(array $dataSource)
    {
    if (isset($dataSource['data']['items'])) 
        {
        $fieldName = $this->getData('name');
        foreach ($dataSource['data']['items'] as & $item) 
            {
            if (isset($item['id'])) 
                {                   
                $html = '<input type="button" id="adresar" value="Přidat" onclick="addAdresar();">';
                $item[$fieldName] = $html;
                }
            }
        }
    return $dataSource;
    }

My JS map Vendor/Module/view/adminhtml/web/requirejs-config.js

    var config = {
map: {
    '*': {
        adresar: 'Vendor_Module/js/adresar',
    }
}
};

Now I need call my custom js function in this: Vendor/Module/view/adminhtml/web/js/adresar.js

require(
    [
        'jquery',
        'jquery/ui',
        'Magento_Ui/js/modal/modal'
    ],
    function($) {
        "use strict";
        return function addAdresar() {
            alert('Hello!');
            }          
    }
);

Thanks for any ideas!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda