Error Buttons

Error Buttons

DameDame Posts: 1Questions: 1Answers: 0

Good afternoon.
When connecting the buttons, I get errors, please help me figure it out.
I connect all files / libraries separately, as indicated in the constructor when downloading
Errors in the visual studio development environment:

Возникло исключение в строке 7152, столбце 55 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a138f - JavaScript runtime error: Object.getOwnPropertyDescriptor: argument is not an Object
Возникло исключение в строке 7152, столбце 55 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a138f - JavaScript runtime error: Object.freeze: argument is not an Object
Возникло исключение в строке 7152, столбце 55 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a138f - JavaScript runtime error: Object.keys: argument is not an Object
Возникло исключение в строке 11336, столбце 5 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'entries'
Возникло исключение в строке 45162, столбце 9 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'Symbol(Symbol.iterator)_3.d4h1c4j5a6r'
Возникло исключение в строке 11336, столбце 5 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/pdfmake-0.1.36/pdfmake.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'entries'
Необработанное исключение в строке 1066, столбце 5 в http://localhost:50629/Scripts/DataTablesNew/DataTablesNew/Buttons-1.6.4/js/buttons.html5.js
0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'trim'

Buttons csv, print, copies, work fine.
Buttons pdf - hangs on large tables.
Buttons excel - when pressed, I get various errors (buttons.html5.js)

Code table:

function x4() {
        if ($("table").is("#x1")) {
            var table = $('#x1').DataTable();
            table.destroy();
            $('#x1').empty();
            var tables = document.getElementById("x1");
            tables.parentNode.removeChild(tables);
        }

        var dat1 = document.getElementById('datepicker').value;
        var dat2 = document.getElementById('datepicker2').value;

        //Создаём таблицу
        var x = document.createElement("TABLE");
        x.setAttribute("id", "x1");
        x.setAttribute("class", "display");
        x.setAttribute("style", "width:80%");
        document.body.appendChild(x);

        //Создаём футер
        var xfoot = x.createTFoot();
        var xrow = xfoot.insertRow(0);
        for (var i = 0; i < 5; i++) {
            var cell = xrow.insertCell(i);
        }

        $(document).ready(function () {
            $('#x1').DataTable({
                dom: 'Bfrtip',
                buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],
                //{ extend: 'collection', text: 'Export', buttons: ['copy', 'csv', 'excel', 'pdf', 'print'] }], /*csvHtml5*/
                lengthChange: true,
                processing: false,
                searching: true,
                pading: true,
                ordering: true,
                info: true,
                lengthChange: true,
                autoWidth: true,
                lengthMenu: [[50, 100, 100, -1], [50, 100, 1000, "All"]],
                //destroy: true,
                ajax: {
                    url: "/Statistics/StatisticX4Json",
                    data: function (d) {
                        d.dat1 = dat1;
                        d.dat2 = dat2;
                    }
                },
                columns: [
                    { title: "Conf ID", data: "s2" },
                    { title: "Party ID", data: "s3" },
                    { title: "Point Name", data: "s4" },
                    { title: "Cause Disconnected", data: "s5" },
                    { title: "Count", data: "s6" },
                ],
                initComplete: function () {
                    this.api().columns().every(function () {

                        $(select).click(function (e) {
                            e.stopPropagation();
                        });
                        var column = this;
                        var select = $('<select><option value=""></option></select>')
                            //.appendTo($(column.footer()).empty())
                            .appendTo($(column.header()))
                            .on('change', function () {
                                var val = $.fn.dataTable.util.escapeRegex(
                                    $(this).val()
                                );

                                column
                                    .search(val ? '^' + val + '$' : '', true, false)
                                    .draw();
                            });
                        column.data().unique().sort().each(function (d, j) {
                            //column.cells('', column[0]).render('display').sort().unique().each(function (d, j) {
                            select.append('<option value="' + d + '">' + d + '</option>')
                        });
                    });
                }
            });
        });
    }

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.