Server side: apply a class to
Server side: apply a class to
Hi,
I use "serverside" with success. I have a difficulty to applied a class (color cel) to <td>.
I must to apply this class in the ajax code (not in javascript) because this class is different for each cell, depend values retrieve form adatabase.
I didn't find explication on the documentation.
Thank's for your help
CODE HTML VIEW and JS
$url_pointage_liste = "'" . site_url() . 'organisation/list_organisation_serverside_evt' . "'";
$('#list_organisation_serverside').dataTable( {
"processing": true,
"serverSide": true,
"ajax": <?php echo $url_pointage_liste?>,
"pagingType": "full_numbers",
"lengthMenu": [[50, 100, 200], [50, 100, 200]],
"language": {
"loadingMessage": 'Recherche / Loading...',
"lengthMenu": "Affichage/Display _MENU_",
"zeroRecords": "Aucun enregistrement / Nothing found",
"info": "Page _PAGE_ of _PAGES_",
"infoEmpty": "Aucune valeur retournée! / No records available!",
"infoFiltered": "( _MAX_ ligne total / total records)",
"search": "?",
},
"paginate": {
"first": "<<",
"last": ">>",
"next": ">",
"previous": "<"
}
} );
CODE PHP AJAX
public function list_organisation_serverside_evt()
{
$draw = $_GET['draw']; // Compteur d'appel
$start = $_GET['start']; // 1ere page
$length = $_GET['length']; // Nombre d'enregistrement retourné. -1 = tous les enregistrements sont traités
$search = $_GET['search']['value']; // Chaine de recherche
$tab_order = $_GET['order'][0];
$order = $tab_order['column'];
$dir = $tab_order['dir'];
// Initialisation
$liste_enr = array();
...
$query = $this->Organisat............
foreach ($query->result() as $row)
{
$tmp = array();
// Build the line
$tmp[] = addslashes($row->name);
$tmp[] = addslashes($row->amoun);
// This is the problem, i must to apply a class color (amount > 1000 = blue, ....
// Build tab
$liste_enr[] = $tmp;
}
.....