Individual column search
Filter per-column via DataTables search API
DataTables has the ability to apply searching to a specific column through the
column().search() method.The following example shows how to use the Datatables PHP library to power that per-column search.
| ID | Track Name | Album | MediaType |
|---|---|---|---|
| Loading… | |||
| ID | Track Name | Album | MediaType |
<?php
use Ozdemir\Datatables\Datatables;
use Ozdemir\Datatables\DB\SQLite;
Route::get('/ajax/individual-search', function () {
$path = dirname(__DIR__).'/database/Chinook_Sqlite_AutoIncrementPKs.sqlite';
$dt = new Datatables(new SQLite($path));
$dt->query('Select TrackId, Track.Name, Title as Album, MediaType.Name as MediaType
from Track
JOIN Album ON Album.AlbumId = Track.AlbumId
JOIN MediaType ON MediaType.MediaTypeId = Track.MediaTypeId');
return $dt->generate();
});