Why attribute a didn't show in page 2 and so on datatable?

Advertisements

I has make datatable with laravel in simple mode like this

<tbody>
  @php
    $i = 1;
  @endphp
  @foreach ($data_transaction as $item)
  @php
    $encrypt = Crypt::encrypt($item->id);
  @endphp
  <tr>
    <td>{{$i}}</td>
    <td>{{$item->work_order_number}}</td>
    <td>{{$item->customer_name}}</td>
    <td>Rp {{number_format($item->details->sum('amount'))}}</td>
    <td>
      <a href="{{url('read-transaction-' . $encrypt)}}"><i data-feather="eye"></i></a>
    </td>
  </tr>
  @php
    $i++;
  @endphp
  @endforeach

in page one, everything looks ok.

But afther that, in page 2 and so on the view icon is disappear

my datatables initialization just like this

$(document).ready(function() {
  $('.datatables').DataTable();
  feather.replace()
})

Am I did something wrong?

>Solution :

I had the same issue and I added the callback function in datatable and the issue was resolved. Kindly check the below Answer.

$('.datatables').dataTable( {
    "drawCallback": function( settings ) {
        feather.replace();
    }
} );

Hope this will help you.

Leave a ReplyCancel reply