Datatable only works on reload

Datatable only works on reload

SimonaSimona Posts: 3Questions: 1Answers: 0

I am using datatable in Laravel-VueJs project. If I reload the page the table works, but without reload it does not.
Any suggestions on how to get the table to display properly without having to reload?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    It sounds like a timing issue - is the DataTable initialised happening before the table or the table's data is in the DOM?

    Colin

  • SimonaSimona Posts: 3Questions: 1Answers: 0

    @colin I am not sure that I understand your question :blush:
    I don't think that is a timing issue cuz I've tried
    setTimeout(function(){
    $(document).ready( function () {
    $('#myTable').DataTable();
    } );
    },1000);
    and nothing changes

  • SimonaSimona Posts: 3Questions: 1Answers: 0
    edited March 2020
    <a :href="$router.resolve({name: 'ListAllMachines'}).href">List All</a>
    <!-- reloads page (dataTable works) -->
    
    <router-link to="/list_all_machine">List All</router-link>
    <!-- does not reload (dataTable does not work ) -->
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're going to need to see it to progress this. 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.

    Colin

This discussion has been closed.