serverside Individual column filtering ( text input )
serverside Individual column filtering ( text input )
kqueekquee
Posts: 40Questions: 1Answers: 0
the filtering on serverside is not working
http://live.datatables.net/nuxufeb/7/edit
http://live.datatables.net/nuxufeb/7/edit
This discussion has been closed.
Replies
http://live.datatables.net/nimawun/3/edit
i have changed code of ' ssp.class.php ' and i can filtering all Individual column
if ( count( $columnSearch ) ) {
$where = $where === '' ?
implode(' AND ', $columnSearch) :
$where .' AND '. implode(' AND ', $columnSearch);
}
i changed ssp.class.php with utf8_encode( to return the spécial caracters in the datatable
// Is there a formatter?
// 28/03/2014 utf8_encode () for spécial character éàèù...
if ( isset( $column['formatter'] ) ) {
$row[ $column['dt'] ] = utf8_encode($column['formatter']( $data[$i][ $column['db'] ], $data[$i] ));
}
else {
$row[ $column['dt'] ] = utf8_encode( $data[$i][ $columns[$j]['db'] ]);
}
}
kqueekquee, you can add support for languages other than those that use latin characters by adding this line:
Right before:
In the simple() function of ssp.class.php. Then in the sql_exec() function replace the return line with this:
thanks
it's ok with ' SSP::sql_exec( $db, "SET character_set_client = 'utf8'"); '
filtering it's ok when i use latin character
SSP::sql_exec( $db, "SET character_set_client = 'utf8'");
$data = SSP::sql_exec( $db, $bindings,
"SELECT SQL_CALC_FOUND_ROWS
".implode("
,", SSP::pluck($columns, 'db'))."
FROM
$table
$where
$order
$limit"
);
// Execute
try {
$stmt->execute();
}
catch (PDOException $e) {
SSP::fatal( "An SQL error occurred: ".$e->getMessage() );
}
// Return all
// return $stmt->fetchAll();
// 23.05.2014 http://datatables.net/forums/discussion/comment/61516#Comment_61516
return $stmt->rowCount() > 0 ? $stmt->fetchAll() : false;
}
christian