Datatables does not recognize VueJs

0

I have the following created component, if you see, I have two console.log () inside the mounted method, one outside datatables and the other inside, and the one inside datatables throws me error that does not recognize. "Can not read property 'roundtwo' of undefined"

<template>

    <div>
        <div class="row">
            <div class="col-md-12">
                <div class="content">
                    <table class="table table-bordered table-striped" width="100%" cellspacing="0" id="dt_results">
                        <thead>
                            <tr>
                                <th class="text-center">Posición</th>
                                <th class="text-center">Jugador</th>                          
                            </tr>
                        </thead>
                        <tbody class="text-center">

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

</template>

<script>
    export default {
        data(){
          return{
              roundtwo:false
          }   
        },
        mounted() {

            console.log(this.roundtwo);     

           $("#dt_results").DataTable({
                destroy: true,
                processing: true,
                serverSide: true,
                stateSave: true,
                responsive: true,
                language:{
                    "url": '/datatable_spanish.json'
                },
                "ajax": {
                    "method": "post",
                    "url": '/results/getResultsDraw',
                    "data": {id_draw:$("#draw").val()} 
                },
                "columns": [ 
                    {
                       "data": "position", name: 'results_draw.position', "mRender": function (data, type, row, gg) {      

                             console.log(this.roundtwo);

                            return  row.position;                                     
                        },
                    },
                    { 
                       "data": "last_name", name: 'users.last_name', "mRender": function (data, type, row, gg) {    
                            return row.nickname != null ? row.nickname + ' ' + row.last_name : row.first_name + ' ' + row.last_name;                                     
                        },
                    },      
                ]
            });
        }
    }
</script>

And if within datatables when I create a column I pass a method, it does not recognize either!

    
asked by Juan Pablo B 09.07.2017 в 05:17
source

0 answers