.tableExport keine Funktion

immer noch mich mit dem gleichen Angebot..

Also ich erkläre es schnell. Ich habe alle includes in meine Seite, so das ist es nicht.

Arbeite ich auf visual studio.

Habe ich eine Tabelle erstellt, die ich exportieren möchten, im pdf-oder irgendetwas anderes. Und so bin ich mit diesem :

https://github.com/hhurz/tableExport.jquery.plugin

Dies funktioniert sehr gut, wenn in meinem code habe ich es so formulieren :

                $('table').tableExport({ type: 'pdf', jspdf: { orientation: 'l', format: 'a3', margins: { left: 10, right: 10, top: 20, bottom: 20 }, autotable: { styles: { fillColor: 'inherit', textColor: 'inherit' }, tableWidth: 'auto' } } });

Offensichtlich umgeben von balisen.

Aber jedes mal, wenn ich will, um diese in eine Taste, es funktioniert nicht !! Chrome Konsole sagen mir das : .tableExport ist nicht eine Funktion

Wie kann es möglich sein ? Es funktioniert gut, wenn ich nur rufen Sie das Skript !

Dies ist mein event und meine Taste (bitte wenn jemand etwas hat, um zu helfen, das wäre wirklich toll !) :

$(document).ready(function () {
                $('#downloadPDF').on('click', function (e) {
                    console.log("test");
                    e.preventDefault();
                    $('table').tableExport({ type: 'csv' });

                    $('table').tableExport({
                        type: 'pdf',
                        jspdf: {
                            orientation: 'l',
                            format: 'a3',
                            margins: {
                                left: 10,
                                right: 10,
                                top: 20,
                                bottom: 20
                            },
                            autotable: {
                                styles: {
                                    fillColor: 'inherit',
                                    textColor: 'inherit'
                                },
                                tableWidth: 'auto'
                            }
                        }
                    });
                });
            });

            <button type="button" id="downloadPDF" class="btn btn-default">Default</button>*@

Danke Jungs.

        <table id="table" class="table table-hover ">

            <tbody>             
                <tr>
                    <td></td>
                    <td> </td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>

            </tbody>




            <tr class="info">
                <td><b></b></td>
                <td></td>
            </tr>

            <tbody>
                <tr>
                    <td>
                        <br /><br />
                         <br /><br />
                        <br /><br />
             </tbody>           
                    </td>
                    <td><br /><br /><br /></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td> </td>
                </tr>
                <tr>
                    <td></td>
                    <td> </td>
                </tr>

            </tbody>

        </table>

    </div>

    @* Bouton extraction *@

        <script>
            $(document).ready(function () {

            });
        </script>
        <script>

        $('#downloadPDF').on('click', function (e) {
                    console.log("test");
                    e.preventDefault();
                    $('table').tableExport({
                        type: 'pdf',
                        jspdf: {
                            orientation: 'l',
                            format: 'a3',
                            margins: {
                                left: 10,
                                right: 10,
                                top: 20,
                                bottom: 20
                            },
                            autotable: {
                                styles: {
                                    fillColor: 'inherit',
                                    textColor: 'inherit'
                                },
                                tableWidth: 'auto'
                            }
                        }
                    });
                });
        </script>


        <button type="button" id="downloadPDF" class="btn btn-default">Default</button>*@

  • Setzen Sie den code auf JSfiddle oder JsBin so dass ich sehen kann, was falsch läuft.
Schreibe einen Kommentar