Datatable
Datatable copied to clipboard
Cannot apply individual column searching
Hello Chumper, Using the below doesn't work for search columns. It still gives me one option to search as in classic datatable views.
public function getDatatable()
{
return Datatable::collection(User::all(array('id','name', 'address')))
->showColumns('id', 'name', 'address')
->searchColumns(array('name', 'address'))
->orderColumns('id','name')
->make();
}
Thanks /maspan
do you have an example?
I couldn't understand how this could work. The search field is only one textbox in the datatables grid, and it searches using the column of the array searchColumns. So what happens if I add more in that array?
Hi Nils, i have an example about the "Individual column searching via ajax" that you can search any columns via typing at very end of every column inputbox. You can see the examples; https://datatables.net/examples/api/multi_filter.html (with text input) and http://www.datatables.net/examples/api/multi_filter_select.html (with select) (but this one is not quite necessary i think).
Hi Chumper,
I would like to set up an example like this one : https://datatables.net/examples/api/multi_filter.html
Is it possible with Chumper/Datatable ?
Can I use it from a controller like this way ? Example :
public function index()
{
// Datatable
$table = Datatable::table()
->addColumn('Nom','Prénom','Age','Datejour','Actions')
->setUrl(route ('api.utilisateurs'))
->setClass('table table-bordered table-hover table-striped table-condensed dataTable no-footer ')
->setOptions(array('language' => array('url'=> '/localisation/FR_fr.json'),
'searchHighlight' => true,
)
)
->noScript();
Return View::make('utilisateurs.index', array('table' => $table));
}
public function apigetUtilisateurs()
{
//
return Datatable::collection(Utilisateur::all(array('nom', 'prenom','age','datejour','id')))
->showColumns('nom', 'prenom','age','datejour')
->addColumn('id', function($model){
return '<a href="/utilisateursTEST/' . $model->id . '">view</a>';
})
->searchColumns('nom','prenom')
->orderColumns('nom','prenom','age','datejour')
->make();
}
Thanks by advance
I've found this closed message :
https://github.com/Chumper/Datatable/issues/52
There's a little bug (see my comment at the end)
Hope this helps.
what happend?? yo can do that? I want to do the same, but fnFilter dosnt Work with custom column index.
I'm with the same problem. How can I fix it?
Did you try it with my explanation in #52 ?
Yep, but I could not fix it reading #52. My project was fixed with #224