KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

I cant display any datable buttons(print button) or search option in datatable #1303

Open iRiyada opened this topic on on Feb 16, 2020 - 2 comments

iRiyada commented on Feb 16, 2020

TypeError: "i is undefined" TypeError: "b.nTableWrapper is null"

iRiyada commented on Feb 16, 2020
  <script type="text/javascript">

KoolReport.load.onDone(function () {

                            var locale='<?php echo $language;?>';
// $('#example1').empty();

            var table1 = $('#example1').DataTable({
                destroy: true,
                "language": {
                    "sProcessing": locale=='ar'?"جارٍ التحميل...":"Processing...",
                    "sLengthMenu":locale=='ar'? "اعرض _MENU_ سجلات":"Show _MENU_ entries",
                    "sZeroRecords": locale=='ar'?"لم يعثر على أية سجلات":"No matching records found",
                    "sInfo":locale=='ar'? "إظهار _START_ إلى _END_ من أصل _TOTAL_ مدخل":"Showing _START_ to _END_ of _TOTAL_ entries",
                    "sInfoEmpty": locale=='ar'?"يعرض 0 إلى 0 من أصل 0 سجل":"Showing 0 to 0 of 0 entries",
                    "sInfoFiltered": locale=='ar'?"(منتقاة من مجموع _MAX_ مُدخل)":"(filtered from _MAX_ total entries)",
                    "sInfoPostFix": "",
                    "sSearch": locale=='ar'?"ابحث:":"Search:",
                    "sUrl": "",
                    "oPaginate": {
                        "sFirst": locale=='ar'?"الأول": "First",
                        "sPrevious": locale=='ar'?"السابق":"Last",
                        "sNext": locale=='ar'?"التالي":"Next",
                        "sLast": locale=='ar'?"الأخير":"Previous",
                    },
                },
                dom: 'lBfrtip',
                "buttons": [
                    {
                        extend: 'print',
                        text: '<i style="color:#a9a9a9;" class="fa fa-print"></i>',
                        titleAttr: 'طباعة',
                        autoPrint: true,
                        cssClass: 'printButton',
                        exportOptions: {
                            columns: ':visible',
                        },
                        customize: function (win) {
                            $(win.document.body).find('table1').addClass('display').css('font-size', '9px');
                            $(win.document.body).find('table1').addClass('display').css('direction', 'rtl');
                            $(win.document.body).find('tr:nth-child(odd) td').each(function (index) {
                                $(this).css('background-color', '#D0D0D0');
                            });
                            $(win.document.body).find('h1').css('text-align', 'center');
                            $(win.document.body).find('th').css('background-color', '#20a8d8');
                        }
                    },
                  
                ],
                "columnDefs": [{
                    "searchable": true,
                    "orderable": true,
                    "targets": 0
                },
            ], "order": [[0, 'asc']],

               
            });
           
            table1.buttons().container().appendTo($('#button1'));
         
        });
          </script>

iRiyada commented on Feb 24, 2020

That was a mistake in initialising class. It is working now.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None