How to add array in datatables? (laravel)

How to add array in datatables? (laravel)

jer040506jer040506 Posts: 5Questions: 3Answers: 0

Controller

 array_push($results, [
            'name' => $name,
            'last_modified' => $lastmodified,
            'size' => $this->humanReadable($size),
        ]);

    return Datatables::of($results)->make(true);

JS

$(function() {
    var table = $('#backuptable').DataTable({
     processing: false,
     serverSide: true,
     ajax: '{!! route('get.backup') !!}',
     columns: [
         { data: 'name', name: 'name' },
         { data: 'last_modified', name: 'last_modified' },
         { data: 'size', name: 'size' },
        ]
     });
  });

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Do you want to give us some clues? Are you seeing errors? Is the table not loading?

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.