0
How to configure Datatables to compile html code?
The intention was to leave the text "Active" in green or color that indicates success according to the theme.
Table Initialization Code:
const altbl = $('#trimestre-table').DataTable({
processing: true,
serverSide: true,
ajax: '{!! route('datatables.trimestre') !!}',
columns: [
{data: 'id', name: 'id'},
{data: 'descricao', name: 'descricao'},
{data: 'ini', name: 'ini'},
{data: 'fin', name: 'fin'},
{data: 'status', name: 'is_active'},
{
defaultContent: "<a href='#!' class='m-r-15 text-muted' id='edit' data-toggle='tooltip' data-placement='top' title='' data-original-title='Editar'><i class='icofont icofont-ui-edit'></i></a>"
+ "<a href='#!' class='text-muted' id='delete' data-toggle='tooltip' data-placement='top' title='' data-original-title='Deletar'><i class='icofont icofont-delete-alt'></i></a>",
className: 'action-icon text-center'
}
],
language: {
"sEmptyTable": "Nenhum registro encontrado",
"sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered": "(Filtrados de _MAX_ registros)",
"sInfoPostFix": "",
"sInfoThousands": ".",
"sLengthMenu": "_MENU_ resultados por página",
"sLoadingRecords": "Carregando...",
"sProcessing": "Processando...",
"sZeroRecords": "Nenhum registro encontrado",
"sSearch": "Pesquisar ",
"oPaginate": {
"sNext": "Próximo",
"sPrevious": "Anterior",
"sFirst": "Primeiro",
"sLast": "Último"
},
"oAria": {
"sSortAscending": ": Ordenar colunas de forma ascendente",
"sSortDescending": ": Ordenar colunas de forma descendente"
}
},
initComplete: function (settings, json) {
$('[data-toggle="tooltip"]').tooltip();
},
order: [[0, "desc"]],
});
Place
console.log(json);
in the Function ofinitComplete
and see what it shows.– Sam
Should I look for something specific? I don’t understand...
– Jean Freitas
It will return a JSON, correct? See what shows in this JSON the value where this has
span
?– Sam
Displays data but with html entities
– Jean Freitas
In the database tb is with html entities?
– Sam