jquery datatable server side multi column filter
jquery datatable server side multi column filter
nanogr000
Posts: 1Questions: 1Answers: 0
I am using jquery datatables to load data server side into my table:
https://datatables.net/examples/data_sources/server_side
I have set a class whitch return me the formatted json string:
$columns = array(
array( 'db' => 'first_name', 'dt' => 0 ),
array( 'db' => 'last_name', 'dt' => 1 ),
array( 'db' => 'position', 'dt' => 2 ),
array( 'db' => 'office', 'dt' => 3 ),
array(
'db' => 'start_date',
'dt' => 4,
'formatter' => function( $d, $row ) {
return date( 'jS M y', strtotime($d));
}
),
array(
'db' => 'salary',
'dt' => 5,
'formatter' => function( $d, $row ) {
return '$'.number_format($d);
}
)
How is it possbile to get multiple db inside an array? For example I would like to combine first_name and last_name inside a column
Answers
It might be easier to do it on the client-side, see example here - it's putting the age column into the first name, similar to what you would do with the two names,
Colin