PHP code example of viveksingh / dynamic-datatable

1. Go to this page and download the library: Download viveksingh/dynamic-datatable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

viveksingh / dynamic-datatable example snippets


    public function getData(Request $request){        
        return DynamicDatatable::table($request);    
    }

    public function getData(Request $request){        
        return DynamicDatatable::table($request, 'table_name');    
    }

 $(document).ready(function() {
        $('#table').DataTable({
            processing: true,
            serverSide: true,
            paging: true,
            ajax: {
                url: "{{ route('admin.getUser') }}",
                data: {
                    table_name: 'users'
                }
            },
            columns: [{
                    data: 'id',
                },
                {
                    data: 'name',
                },
                {
                    data: 'email',
                }
            ],
        });
    });