I can not seem to show the buttons on my dataTables.net . I tried several examples and I did not succeed. the version of my dataTables.net is: 1.10.15. Usage in Asp.net MVC. Could you help? Thank you.
< script type = "text/javascript" >
$(document).ready(function() {
var table = $('#dataTable').DataTable({
dom: 'Bfrtip',
buttons: [{
Text: "teste"
}],
buttons: true,
processing: true,
serverSide: true,
searchable: true,
"aaSorting": [
[1, "asc"]
],
"columnDefs": [{
"targets": [0],
"visible": false,
"searchable": false
},
{
"targets": [-1],
"orderable": false,
"searchable": false
}
],
ajax: {
"url": '@Url.Action("GetOrganizations")',
"type": "POST",
error: function(jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
//or you can put jqXHR.responseText somewhere as complete response. Its html.
}
},
columns: [{
data: "CORID",
"name": "CORID"
},
{
data: "DESCRICAOCOR",
"name": "DESCRICAOCOR"
},
{
data: "STATUSCOR",
"name": "STATUSCOR",
render: function(data, type, row) {
if (data) {
return '<input type="checkbox" checked onclick="return false">'
} else {
return '<input type="checkbox" value="0" onclick="return false">'
}
}
},
{
data: null,
render: function(data, type, full) {
var strBotaoEditar = '<a class="btn btn-primary btn-sm" href=#/' + full[0] + 'editar>' + 'Editar' + '</a>';
var strBotaoDetalhe = '<a class="btn btn-info btn-sm" href=#/' + full[0] + 'detalhe>' + 'Detlahes' + '</a>';
return strBotaoEditar + strBotaoDetalhe;
}
},
],
});
}); <
/script>
<link href="~/Content/jquery.dataTables.min.css" rel="stylesheet" />
<link href="~/Content/DataTables/extensions/Buttons/css/buttons.dataTables.min.css" rel="stylesheet" /> @{ ViewBag.Title = "Listagem Geral"; Layout = "~/Views/Shared/_Layout.cshtml"; }
<p>
<a title="Inserir novo registro" class="btn btn-success" href="@Url.Action(" Create ", "Cad_COR ")">
<i class="glyphicon glyphicon-plus"></i>
</a>
</p>
<table class="display table-striped row-border header-fixed" id="dataTable" style="width:100%">
<thead>
<tr>
<th>
Cor Id
</th>
<th>
Descrição Cor
</th>
<th>
Status Cor
</th>
<th>
Ação
</th>
</tr>
</thead>
</table>
<script src="~/Scripts/jquery-1.12.4.js"></script>
<script src="~/Scripts/DataTables/media/js/jquery.dataTables.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/dataTables.buttons.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.bootstrap.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.colVis.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.flash.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.foundation.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.html5.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.jqueryui.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.print.min.js"></script>
<script src="~/Scripts/DataTables/extensions/Buttons/js/buttons.semanticui.min.js"></script>