State Save not working. Looking for rootcause.

State Save not working. Looking for rootcause.

GalileoGalileo Posts: 4Questions: 1Answers: 0

Dear Forum,

i integrated the datatable and i would like to add now a state save function but with adding the script it seems to be not done. Tried several solutions but without any success. May be you see the issue in my code example? Thank you for helping me out! :)

(Header)

<!-- CSS Bootstrap für Tabellen Design -->
    <link href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css" rel="stylesheet" crossorigin="anonymous" />


(Script i found on site)

<script>
                    $(document).ready(function() {
                        $('#dataTable').DataTable({
                            stateSave: true
                        });
                    });
                </script>


(My table)

                <div class="card mb-4 shadow">
                    </h6>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table" id="dataTable" width="100%" cellspacing="0">
                                <thead>
                                    <tr>

                                        <th>Audit ID</th>
                                        <th>Startdatum</th>
                                        <th>Lieferant/Organisation</th>
                                        <th>Standort</th>
                                        <th>Fragebogen</th>
                                        <th>Audit Typ</th>
                                        <th>Erfüllung</th>
                                        <th>Ergebnis</th>
                                        <th width="5%">Bearbeiten</th>
                                    </tr>
                                </thead>
                                <tfoot>
                                    <tr>
                                        <th>Audit ID</th>
                                        <th>Startdatum</th>
                                        <th>Lieferant/Organisation</th>
                                        <th>Standort</th>
                                        <th>Fragebogen</th>
                                        <th>Audit Typ</th>
                                        <th>Erfüllung</th>
                                        <th>Ergebnis</th>
                                        <th width="5%">Bearbeiten</th>
                                    </tr>
                                </tfoot>
                                <tbody>


                                </tbody>
                            </table>


(Footer Section)

<!-- Data Tables CDN: https://cdn.datatables.net/ -->
<script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js" crossorigin="anonymous"></script>

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 10,638Questions: 25Answers: 2,428

    The State Save example works. If your page doesn't work then please post a link to your page or.a test case so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Do get get any alert messages or errors in your browser's console?

    Kevin

  • GalileoGalileo Posts: 4Questions: 1Answers: 0
    edited September 15

    Hey, i have found out following. On local host the script is not working but on my server it works. I am not sure why... do you know this problem? Same script and configurations...

  • colincolin Posts: 9,822Questions: 0Answers: 1,629
    Answer ✓

    The state is stored in the browser, not on the server, so the location of the table wouldn't have an effect. No idea why you'd be seeing that.

    Colin

  • GalileoGalileo Posts: 4Questions: 1Answers: 0

    Is it done by session or which method?

  • GalileoGalileo Posts: 4Questions: 1Answers: 0

    OK i found the issue. It is a conflict with my session management in Google Chrome. For development i am using local a plugin which is affecting the storage. This i am not using in my web server version. On different bwoser it is working also local. So issue can be closed.

    Thank you for your support!

Sign In or Register to comment.