PHP code example of totop275 / ss-datatables

1. Go to this page and download the library: Download totop275/ss-datatables 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/ */

    

totop275 / ss-datatables example snippets


...
use Kitablog\Traits\Datatables;
...
class MyController extends Controller{
  use Datatables;
...

      $this->column=[ 
       'alias' => ['item_name'=>'items.name','item_unitime'=>'concat(items.uq,UNIX_TIMESTAMP())'],
       'available' => ['name','gender','item_name','item_unique'],
       'searchable' => ['name','item_name'],
       'table' => '['items'=>['users.item','=','items.id'],'address'=>['address.user','=','users.id']]'
      ]

      $this->actionBtn=[
        ['<a href="'.url('user/item').'/%s/edit" class="btn btn-sm btn-flat btn-info">Edit</a>','id'],
        [' <btn class="btn btn-sm btn-flat btn-danger btnDelete" data-id="%s">Delete</btn>','id']
      ];

    Route::get('ajax','YourController@list')
  

  ...
  use Kitablog\Traits\Datatables;
  ...
  class MyController extends Controller{
    use Datatables;
  ...
  public function showAll(Request $request){
    if($request->input('ajax')){
      return $this->list($request);
    }
    ...
  }