Datatables for going a bit crazy
Datatables for going a bit crazy
Fran25ans
Posts: 2Questions: 2Answers: 0
I want to join the two codes but it does not work, you can help me?
$(document).ready(function() {
$('#tabla').DataTable( {
"language": {
"lengthMenu":"Mostrar _MENU_ registros por página.",
"search" : "Buscar",
"zeroRecords": "Lo sentimos. No se encontraron registros.",
"info": "Mostrando página _PAGE_ de _PAGES_",
"infoEmpty": "No hay registros aún.",
"infoFiltered": "(filtrados de un total de _MAX_ registros)",
"LoadingRecords": "Cargando ...",
"Processing": "Procesando...",
"SearchPlaceholder": "Comience a teclear...",
"paginate": {
"previous": "Anterior",
"next": "Siguiente",
}
},
"sort": false
} );
} );
AND
$(function () {
if ($('.dataTable').length > 0) {
$('.dataTable').dataTable({
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
'aoColumnDefs': [{
'bSortable': false,
'aTargets': ['nosorting']
}],
});
$(document).on('keyup', "input[type='number']", function(){
var oTable = $('.dataTable').dataTable();
oTable.fnFilter($(this).val());
});
$('.dataTables_filter').empty(); // clears the content generated
$('.dataTables_filter').append("<div class='input-group' style='width: 250px'>" +
" <input type='number' class='form-control' placeholder='Search..'/>" +
" <span class='input-group-addon'>" +
" <i class='fa fa-search' style='width: 15px; padding-left: 5px'></i>" +
" </span>" +
"</div>")
}
});
This discussion has been closed.