Custom pengaturan Datatable

Assalamu'alaikum wr wb,
Kali ini saya akan share bagaimana caranya custom pengaturan di datatable.
Berikut ini syntaxnya.
_________________________________________________________________________________
<script type="text/javascript">
   var TableToolsInit = {
"oFeatures": {
"bCsv": true,
"bXls": true,
"bCopy": true,
"bPrint": true
},
"sPrintMessage": "",
"sTitle": "",
"sSwfPath": "swf/ZeroClipboard.swf",
"iButtonHeight": 30,
"iButtonWidth": 30
};


 $('#example').dataTable({
"processing": true,
"serverSide": true,
"ajax": "modul/mod_lokasi/proses.php",
"aoColumnDefs": [
{
"aTargets": [ -1 ],
              "mData": 6,  //Get value from RoleId column, I assumed you used "RoleId" as the name for RoleId in your JSON, in my case, I didn't assigned any name in code behind so i used "mData": "0"
                     "mRender": function (data, type, full) {
return '<a href='+'?Pangeran=lokasi&act=edit&id=' + data +'><i class="glyphicon glyphicon-edit"></i></a> | <a href='+'javascript:confirmHapus("modul/mod_lokasi/aksi.php?Pangeran=lokasi&act=delete&id=' + data +'")><i class="glyphicon glyphicon-trash"></i></a>';
                     }
                  }
]

,
responsive: true,
dom: 'T,C<"clear">lfrtip',
tableTools: {
'aButtons': ['copy', 'csv', 'pdf', 'print'],
"sSwfPath": "swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "copy",
"mColumns": [0, 1, 2, 3, 4, 5]
},
{
'sExtends':'csv',
"mColumns": [0, 1, 2, 3, 4, 5],
"sFileName": "DATA_DEPARTEMENT_<?php echo date("Y-m-d");?>.csv"
},
{
"sExtends": "pdf",
"mColumns": [0, 1, 2, 3, 4, 5],
"sFileName": "DATA_DEPARTEMENT_<?php echo date("Y-m-d");?>.pdf"
},
{
"sExtends": "print",
"mColumns": [0, 1, 2, 3, 4, 5],
"sInfo": "Tekan Ctrl + P untuk langsung Print<br>Tekan escape [ESC] saat selesai."
},
]
},
"aLengthMenu": [[10, 25, 50, 100, 250, 500, -1], [10, 25, 50, 100, 250, 500, 'All']],
"oLanguage": {
   "sInfo": 'Total _TOTAL_ Data ditampilkan (_START_ sampai _END_)',
"sLengthMenu": 'Tampilkan _MENU_ Data',
"sInfoEmpty": 'Tidak ada Data.',
"sSearch": 'Pencarian:',
"sEmptyTable": 'Tidak ada Data di dalam Database',
"oPaginate": {
"sNext": 'Selanjutnya',
"sLast": 'Terakhir',
"sFirst": 'Pertama',
"sPrevious": 'Sebelumnya'
}
 }
});

        </script>
_________________________________________________________________________________
Semoga bermanfaat.
http://pangeran-it.blogspot.com/
Custom pengaturan Datatable Custom pengaturan Datatable Reviewed by Syawaluddin Amin, S.Kom on Januari 27, 2015 Rating: 5

2 komentar:

Diberdayakan oleh Blogger.