Please see html is showing when im showing datatable by using laravel 5.4 and yajra. i have tried render function and html decode in java script but not successful
Controller
$contacts = DB::table('contacts')->select('id','Name','email','status');
return Datatables::of($contacts)
->addColumn('action', function($row) {
$_url = url('/showUpdateContact/' . $row->id);
$link = "<a href=\"$_url\" data-original-title=\"Edit\">Edit</a>";
$_url = url('/deleteContact/' .$row->id);
$link .= "<a title=\"Delete Contact\" data-original-title=\"Delete\" href=\"javascript:deleteItem('$_url')\">Delete</a>";
return ($link);
})
->removeColumn('id')
->make();
**View**
<script type="text/javascript">
jQuery(document).ready(function() {
var DTable = jQuery('#contactsTable').DataTable({
"processing": false,
"serverSide": true,
"pageLength": 10,
"bPaginate": true,
"ordering": false,
"bLengthChange": true,
"bFilter": true,
"bInfo": true,
"ajax": {
"url": "",
"cache": false,
"Content-Type": "text/html",
"data": function ( d ) {
//d.cus_filter_on = $('#filter_on').val();
},
"complete": function() {
//Remove select2 effects from page length dropdown
//jQuery("select[name='contactsTable_length']").select2('destroy');
//jQuery('.loading').css('display','none');
},
},
"columnDefs": [
{ "searchable": false, "targets": 0,
render: function ( data, type, row, meta ) {
console.log(data);
console.log(type);
console.log(row);
console.log(meta);
console.log('------');
return $('<div/>').html(data).text();
}
}
],
}); //DataTable ends
}); //ready ends
</script>
I have also tried render function not luck
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2nHKzhe
via IFTTT
Aucun commentaire:
Enregistrer un commentaire