I am really new using Laravel 4. I have a very simple problem here.
I am calling this query with this.
$users = DB::table('alumnos')->select(array('id', 'Nombre', 'Apellidos','Seccion','Grado','Preceptor','P1','P2','P3','P4','P5','P6','P7','P8'));
return Datatables::of($users)
And I am populating a table like this:
+--------+-----------+------------+
| Nombre | Apellidos | P1 |
+--------+-----------+------------+
|Nombre 1|Apellido1 | 0 |
|Nombre 1|Apellido1 | 1 |
|Nombre 1|Apellido1 | 0 |
|Nombre 1|Apellido1 | 1 |
|Nombre 1|Apellido1 | 1 |
|Nombre 1|Apellido1 | 1 |
+--------+-----------+------------+
The table is populated using javascript code:
var oTable;
$(document).ready(function() {
oTable = $('#registros').dataTable( {
"sDom": "<l><f><r>t<i><p>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sSearch": "Search:",
"sLengthMenu": "_MENU_ records per page"
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('registrar/datadirectivos') }}"
});
$("#users_filter input").addClass("form-control inline-control input-sm");
$("#users_length select").addClass("form-control inline-control");
});
What I want to do is change the last column named Preceptoria, that instead of numbers the column show buttons dinamically colored depending if its 1 a button colored in green and if its 0 a button colored in red.