[TIPS] Menambahkan Export Excel dan PDF di widget Datatables Yii2

Februari 24, 2018

sama seperti tips sebelumnya saya masih pakai https://github.com/fedemotta/yii2-widget-datatables sebagain extension pengganti grdiview Yii2 selain kartik, OK langsung aja,sesuai readme nya di untuk export bisa tambahkan


<span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span>tableTools<span class="pl-pds">"</span></span><span class="pl-k">=></span>[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>aButtons<span class="pl-pds">"</span></span><span class="pl-k">=></span> [ </span> <span class="pl-s1"> [</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>copy<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Copy to clipboard<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>csv<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Save to CSV<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>xls<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>oSelectorOpts<span class="pl-pds">"</span></span><span class="pl-k">=></span> [<span class="pl-s"><span class="pl-pds">"</span>page<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">'</span>current<span class="pl-pds">'</span></span>]</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>pdf<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Save to PDF<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],[</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sExtends<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-s"><span class="pl-pds">"</span>print<span class="pl-pds">"</span></span>,</span> <span class="pl-s1"> <span class="pl-s"><span class="pl-pds">"</span>sButtonText<span class="pl-pds">"</span></span><span class="pl-k">=></span> <span class="pl-c1">Yii</span><span class="pl-k">::</span>t(<span class="pl-s"><span class="pl-pds">'</span>app<span class="pl-pds">'</span></span>,<span class="pl-s"><span class="pl-pds">"</span>Print<span class="pl-pds">"</span></span>)</span> <span class="pl-s1"> ],</span> <span class="pl-s1"> ]</span> <span class="pl-s1"> ]
</span>

eh nyatanya itu not work, krn dia pakai flash, akhirnya saya modify sedikit (ngapus sedikit) dari sintax sebelumnya, awalnya

saya komen di bagian tableTools jadi

selanjutnya kita tambahakan js dan css di file appasset.php ,
button export dari datatable https://datatables.net/extensions/buttons/examples/initialisation/export.html

public $css = [
'css/site.css',
' https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css',
'https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css',
];
public $js = [
'js/FileSaver.js',
' https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js',
'https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js',
];

terus di confignya widget datatable

Ok sudah tampilnya jd gini deh

 

Iklan

Tips – Trik Desain Laporan di PHP

Juni 28, 2017

Sesuai judul deh, saya ada kasus nih desain laporan di PHP, pake HTML enaknya yaa kan kebetulan saya pake Mpdf, yang ribet dari php ini adalah bikin laporan (menurut saya sih) karena harus berkutat di tag tr,td, collspan,rowspan kadang saya males , saya sempat mikir ada ga yang drag drop HTML kaya DW, lamaaaa sudah berkutat tr td buat bikin repot akhirnya saya punya alternatif biar mempercepat kerjaan tanpa mikir sususan tag table dan kawan kawannya apalgi pake Css biar pas sesuai permintaan klient, contoh kaya digambar ini

berikut caranya Baca entri selengkapnya »


[Foxpro]Fingerspot Digital Persona U.are.U

Juni 18, 2017

OK langsung aja, cara menghubungkan fingerprint merek U are U di foxpro 🙂 disampelnya emank ga ada foxpro jelas ga ada mimpi klo ada 😀 , yang ada salah satunya adalah vb6, klo vb6 bisa kenapa foxpro ga bisa Ok , emank bagus sih sample vb6 OK lah, foxpro bisa lakukan itu juga sederhana dan to the point 😀 , OK lanjut

pertama instal SDK nya saya anggap bisa lah

kedua, di foxpro buka, pada menubar tool > object browser

klik tombol yang berwarna merah kemudian muncul kotak dialoh open pilih tab COM Libraries cari FlexCode SDK, dan OK

ketiga, pada object browser di kolom class & member, klik tanda plus (+) disamping flexcodeSDK, dibawahnya ada tulisanya interface

Baca entri selengkapnya »


[Foxpro]Menjalan Exe Foxpro on linux Mint

Mei 27, 2017

ok kali ini iseng ga ada niat pake wine apalagi foxpro di laptop kerja, kecuali laptop rumah baru pake windows, Ok saya tetap sangka baik aja foxpro masih bagus di windows masih bagus, di linux mending jangan deh :v ntr susah move on lo he , ok saya gunakan distro linux mint ,langsung aja ni

pertama pastinya instal wine adalah digoogle , saya ga harus jelaskan ini 😀

kedua, sebagai contoh saya gunakan foxpro portable aja yang saya ambil di instalan foxpro di windows

ketiga, install MDAC , caranya via winestick

pilih select the default wineprefix

Baca entri selengkapnya »


[Jasa] Terima Jasa Integrasi BPJS dan InaCBG dengan Aplikasi SimRS (Foxpro)

Mei 22, 2017

saya punya webservice yang bisa di koneksikan dengan BPJS dan InaCBG cukup ganti user dan secret key serta link IP InaCBG, aplikasi dengan foxpro pun bisa di konekkan dengan return JSON dari webservice,  biayanya bisa nego lah saya kasih (webservice+project contoh dengan foxpro lengkap real)

*sudah support VClaim v.1.0  ,  jika ingin menambahkan inhealt juga bisa 😀 formnya sudah disediakan

 

KABAR BAIK, foxpro sudah bisa langsung bridging dengan webservicenya vclaim dan inacbg

PERHATIAN, SAYA BELUM PERNAH MENGUJI DAN PENGGUNAKAN INI, TAPI SAYA SERTAKAN CONTOH SEDERHANA DIDALAMNYA GIMANA REWRITE DARI APLIKASI SEBELUMNYA (UNTUK SAAT INI SAYA TIDAK SUPPORT INI)

pastinya saya support(fix bug) kq ampe tuntas OK

Info lanjut bisa WA : 081311212216