0

How do I add the delete button using the jQuery DataTables api? I was able to install the Datatable, but I can not implement the methods.

Can someone help me ?

https://github.com/yajra/laravel-datatables#jquery-datatables-api-for-laravel-45  

this is my controller

 public function getIndex()
{
    return view('usuarios');
}

public function anyData()
{
    return datatables()->eloquent(mytable::query())->make(true);

}

this is my blade.php

    <table id="users-table" class="table table-bordered">
     <thead>
        <tr>
        <th>data_1</th>
        <th>data_2</th>
        <th>data_3/th>
        <th>data_4</th>
        <th>data_5</th>
        <th>data_6</th>
        <th>data_7</th>
        <th>data_8</th>
        </tr>
    </thead>


    </div>

this is my ajax

<script>
$(function() {
    $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: 'localhost/anyData',
        columns : [
            {data: 'data_1'},
            {data: 'data_2'},
            {data: 'data_3'},
            {data: 'data_4'},
            {data: 'data_5'},
            {data: 'data_6'},
            {data: 'data_7'},
            {data: 'data_8'}

        ]
    });
});

</script>

1 Answer 1

1

The DataTables documentation shows an example on how to delete a row by clicking on an icon inside de row.

Also it seems like the <table> element is not properly closed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.