custom http variables

custom http variables

judajuda Posts: 0Questions: 0Answers: 0

Hello, I'm trying to use the method get, to filter information in the table, but i can't do it work.
This is my code:

/Index.php/
$('#lista').dataTable( {
"responsive": false,
"details": true,
"order": [ 1, 'asc' ],
"processing": true,
"stateSave": false,
"serverSide": true,
"asSorting": [6],
"ajax": "php/server_processing.php",
"language": {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar MENU registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible",
"sInfo": "Mostrando registros del START al END de un total de TOTAL registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de MAX registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$('td:eq(7)', nRow).html('<a href="pago.php?id=' + aData[7] + '" title="Agregar un pago"><img src="images/pago.png"></a> <a href="historial.php?id=' + aData[7] + '" title="Ver el historial de pagos"><img src="images/historial.png"></a> <a href="contrato.php?id=' + aData[7] + '" title="Ver el contrato"><img src="images/contrato.png"></a> <a href="eliminar.php?id=' + aData[7] + '" title="Eliminar registro"><img src="images/eliminar.png"></a>');
return nRow;
},
"aoColumnDefs": [ {
"bSortable": false,
"aTargets": [7]
}
]
} );

/server_processing.php/
$columns = array(
array( 'db' => 'contrato', 'dt' => 0 ),
array( 'db' => 'nombre', 'dt' => 1 ),
array( 'db' => 'apellido', 'dt' => 2 ),
array( 'db' => 'propiedad', 'dt' => 3 ),
array(
'db' => 'deuda_total',
'dt' => 4,
'formatter' => function( $d, $row ) {
return '$'.number_format($d);
}
),
array(
'db' => 'ultimo_pago',
'dt' => 5,
'formatter' => function( $d, $row ) {
$dia = explode("-", $d, 3);
$year = $dia[0];
$month = (string)(int)$dia[1];
$day = (string)(int)$dia[2];

        $dias = array("Dom","Lun","Mar","Mie" ,"Jue","Vie","Sab");
        $tomadia = $dias[intval((date("w",mktime(0,0,0,$month,$day,$year))))];

        $meses = array("", "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic");

        return $tomadia." ".$day." de ".$meses[$month]." de ".$year;

        //return date('d M y', strtotime($d)); Original
    }
),
array(
    'db'        => 'deuda_saldo',
    'dt'        => 6,
    'formatter' => function( $d, $row ) {
        return '$'.number_format($d);
    }
),
array( 'db' => 'id',     'dt' => 7 )

);

// SQL server connection information
$sql_details = array(
'user' => 'local',
'pass' => 'local',
'db' => 'contratos',
'host' => 'localhost'
);

require( 'ssp.class.php' );

echo json_encode(
SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

This discussion has been closed.