PHP MVC Datatables Server Side Processing

Viewed 120

I am using the php mvc framework and i have a database table with over 3000 records so i want to implement server side processing. I have tried to look up tutorials but their structures do not support MVC and it does not work out. This is how i have tried but in vain.

allclients.php

<?php require APPROOT . '/views/inc/adminheader.php';?>

<title>All Clients</title>

 <script>
$(document).ready(function(){
    $('#memListTable').DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": <?php echo APPROOT . '/views/inc/server_processing.php' ?>
    });
});
</script>

<table id="memListTable" class="table display dataTable table-striped table-sm table-hover d-block 
 table-bordered table-body clientTable">
 <thead>
     <tr>
         <th>First name</th>
        <th>Last Name</th>
     </tr>
 </thead>

 <tfoot>
<tr>
    <th>First name</th>
    <th>Last Name</th>
</tr>
</tfoot>

server_processing.php

<?php

$columns = array(
  array('db' => $data['adminclients'] -> name),
  array('db' => $data['adminclients'] -> surname),
);

echo json_encode($columns);
0 Answers
Related