Sending and getting an Array using fnServerParams
Sending and getting an Array using fnServerParams
monstercables
Posts: 1Questions: 1Answers: 0
I am having problems sending and getting data from an array using fnServerParams. Can some one please help?
Thanks my javascript code
var c_year = null;
jQueryNew(document).ready(function(){
c_year = jQueryNew("#tmt_jabatmulai").val() ;
table_jabeks = jQueryNew('#table_jabeks').dataTable({
"sDom": '<"toolbar">rl<"clear"><"pesanpesan">tip',
"bJQueryUI": false,
"aLengthMenu": [[20, 50, -1], [20, 50, "All"]],
"iDisplayLength": 20,
"bAutoWidth": false,
"bProcessing": true,
"bServerSide": true,
"sServerMethod" : "POST",
"bScrollCollapse": true,
"sScrollX": "100%",
"sScrollXInner": "180%",
"sAjaxSource": "/sdm/laporeksekutif/jsonjabeks",
"sPaginationType": "full_numbers",
"bDestroy": true,
"aoColumns": [{ "bSortable": false, "bSearchable": false, "sWidth": "10px"},
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"bFilter": true,
"fnServerParams": function ( aoData ) {
var c_year_param = new Array();
c_year_param['name'] = 'c_year';
c_year_param['value'] = c_year;
aoData.push(c_year_param);
}
});
jQueryNew("#tmt_jabatmulai").change( function() {
c_year = jQueryNew(this).val();
table_jabeks.fnDraw();
});
And in my SQL
$sql = "FROM e_sdm_pegawai_0_tm AS A
JOIN e_sdm_jabatan_eks_0_tm AS B on a.i_peg_nip=b.i_peg_nip
LEFT JOIN bumn_master_baruv2 AS C on b.bumn_id=c.bumn_id2
LEFT JOIN e_sdm_jabatan_eks_0_tr AS D on b.id_jab=d.id
WHERE akhir_tmt IS NOT NULL AND b.awal_tmt>='".$_POST['c_year']."'
GROUP BY a.n_peg, a.i_peg_nip, c.bumn_nama, d.nama_jabatan, b.periode, b.awal_tmt, akhir_tmt, b.honorarium, b.tunj_transport, b.tunj_komunikasi, b.tunj_kesehatan, b.i_dok_dossier
";
$dataTableQuery = $this->dataTableQuery($aColumns, $bColumns, $sql);echo $dataTableQuery[0]. $dataTableQuery[1]. $dataTableQuery[2]. $dataTableQuery[3];die();
$data = $db->fetchall($dataTableQuery[0]. $dataTableQuery[1]. $dataTableQuery[2]. $dataTableQuery[3]);
$number = 1;
$row = array();
foreach($data as $entry) {
if ($_POST['c_year'] != 'awal_tmt' && $_POST['c_year'] != 'akhir_tmt'){
/*if ($entry['is_uploaded'] == 'Y'){
$tindakan = '<img src="/dandelion/images/icons/color/pencil_inactive.png">'.
'<img src="/dandelion/images/icons/color/cross_inactive.png">';
}else{*/
$tindakan = '<a href="#" title="Ubah Data Nama Pegawai" data-skp="'.$entry['id_skp'].'" data-keg="'.$entry['id_keg'].'" class="editSKPKeg"><img src="/dandelion/images/icons/color/pencil.png"></a>
<a href="#" title="Hapus Data Nama Pegawai" data-skp="'.$entry['id_skp'].'" data-keg="'.$entry['id_keg'].'" class="deleteSKPKeg"><img src="/dandelion/images/icons/color/cross.png"></a>';
//}
}
This discussion has been closed.