@yajra ,
can I ask some help how to use in vue.js ?
index.blade
<div class="row" id="app">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title"><a href="{{ route('credit.create') }}" type="button" class="btn btn-block btn-success btn-flat">Create</a></h3>
</div>
<div class="table-responsive box-body">
<table width="100%" class="table table-bordered table-striped" id="my-table">
<thead>
<tr>
<th>Name</th>
<th width="20%;"></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
this is my getdata.js
new Vue({
el:'#app',
created: function () {
var mytable= $('#my-table').DataTable({
processing: true,
serverSide: true,
ajax: 'getdata',
columns: [
{data: 'particulars', name: 'particulars'},
{data: 'action', name: 'action', orderable: false, searchable: false}
]
});
}
});
I tried to play with my custom vue data-table script again. Try using the gist I created as a ref.
Duplicate of #1607
Thanks!
@yajra I have an action button in my controller to eliminate what happened to the table, it is shown and everything, my question is how do I do it for when I click with function @click de vue, js work.
`$('#user-datable').DataTable({
processing: true,
serverSide:true,
language:{
'url': '{!! asset('assets/plugins/datatable/spanish.json') !!}'
},
ajax: '{!! route('user.index') !!}',
columns:[
{data: 'id', name: 'users.id'},
{data: 'firstname', name: 'users.firstname'},
{data: 'lastname', name: 'lastname'},
{data: 'username', name: 'username'},
{data: 'email', name: 'email'},
{data: null, render: function (data) {
return '<span class="badge badge-primary">'+data.display_name+'</span>'
}, orderable:false, searchable:false},
{data: 'action', name: 'action', orderable: false, searchable: false},
]
});`
`return DataTables::eloquent($users)->addColumn('display_name', function (User $user) {
return $user->roles->map(function($role) {
return str_limit($role->display_name, 30, '...');
})->implode(', ');
})->addColumn('action', function ($user) {
return '<a href="user/'.$user->id.'/edit" class="btn btn-default btn-sm btn-icon-anim btn-circle"><i class="fa fa-edit"></i></a>
<button type="button" class="btn btn-default btn-sm btn-icon-anim btn-circle" v-on:click="dete('.$user->id.')"><i class="fa fa-trash"></i></button>';
})->make(true);`
Did you found a solution to @click?
No, I have found the solution
any one found a solution to v-on:click?
Shameless plug, I wrote this datatables.net vue wrapper component: https://github.com/niiknow/vue-datatables-net - @Ubaidullah92 which should have solution for click event
I'm using yajra/laravel-datatables
for server-side response. For native vue support, I also wrote a bootstrap vue items-provider
for b-table
here https://github.com/niiknow/bvtnet-items-provider (see demo)