Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

636
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!