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

638
Vistas
Laravel modal component dont work via back-end render code

I have a laravel modal component which is called via data-modal-toggle attribute. The problem is when I create the button from the backend (via Yajra datatables), It wont work but the other button which has a data-modal-toggle in the blade works fine. Any idea how can i render the said modal?

Here is the code from my backend

        return Datatables::of($apparatus)
            ->addIndexColumn()
            ->addColumn('buttons', function ($row) {
                return '<button type="button" data-modal-toggle="modal-add-app" class="grantors-btn rounded-full font-bold bg-indigo-500 px-4 py-2 text-white">Edit</button>';
            })
            ->rawColumns(['buttons'])
            ->make(true);

As you can see my button has data-modal-toggle attribute but when i click it the component wont show.

But in my blade I tried to have some button that has also the same attribute and calling the same modal component and it works

<button type="button" data-modal-toggle="modal-add-app" class="grantors-btn rounded-full font-bold bg-indigo-500 px-4 py-2 text-white">Add Apparatus</button>

If possible. I want to call the modal via js function

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The button could call a function to show the modal. This what I used:

<td>
    <button class="btn btn-sm btn-link" @click.prevent="showModal()">
         <i class="fas fa-edit text-warning">
    </button>
</td>

And the function to show the modal as below:

showModal() {
        $('#exampleModal').modal('show'); 
 },
about 4 years ago · Juan Pablo Isaza Denunciar

0

I had the same problem just add $(document).ready() inside it type you javascript code to open the modal

about 4 years ago · Juan Pablo Isaza Denunciar
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