my app is with laravel and vue.js, I have a table with data, but I get the message,No data available

my app is with laravel and vue.js, I have a table with data, but I get the message,No data available

slaraslara Posts: 1Questions: 1Answers: 0
edited September 2018 in Free community support
$(document).ready(function() {

    $('#table_id').DataTable();
    

} );

export default {
        data() {
            return {
                editmode: false,
                listProjects : {},
            }
        },   
        methods: {
            loadProjects(){
                axios.get("projects").then(({ data }) => (this.listProjects = data.data));
            },
        },
        created() {
           this.loadProjects();
        },                
        mounted() {
            console.log('Component mounted.')
        }
    }

===================
the data is displayed but the first row shows the message "No data available in table",, how do I solve this problem.???

Also, It does not let me perform any action, since it erases the data

Answers

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

    Hi @slara ,

    If you're getting the "No data available" message and data in the table, it suggests that the data is being loaded into the DOM after the table has been initialised.

    I'm not familiar with laravel, but could this be case, and if so, could you postpone the table initialisation until all the data has been created?

    Cheers,

    Colin

  • noogennoogen Posts: 2Questions: 0Answers: 0

    I've created a Vue wrapper component here: https://github.com/niiknow/vue-datatables-net

    I'm also using it with laravel-datatables server-side endpoint just fine.

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

    Hi @noogen ,

    We're happy to take a look. As per the forum rules, if you could link to a running test case showing the issue we can offer some help. 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.