jeudi 26 juillet 2018

How to create delete button in Api jQuery DataTables?

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>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire