Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
¿Cómo restringir, aparte de los alfabetos y los números, cualquier otra tecla (teclas de función, teclas de acceso directo, etc.) presione la acción en la entrada de búsqueda de la tabla de datos?

jquery:

¿Hay alguna opción para iniciar la búsqueda solo con letras alfabéticas y numéricas?

La búsqueda global de tabla de datos debe iniciar al menos con 3 caracteres

 $(document).on('draw.dt','.dataTable', function() { $(".dataTables_filter input").off().on("input keyup", function(e) { // if value length is greater than 3 or user press enter (keycode = 13) on search we will search on datatable if(this.value.length >= 3 || e.keyCode == 13 || this.value == "") { var dataTable = $('.table').DataTable(); dataTable.search(this.value).draw(); } }); });
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use expresiones regulares con preg_replace para eliminar letras que no sean alfanuméricas en cada teclado y luego verifique la longitud de una cadena.

Espero que obtengas el resultado deseado.

about 4 years ago · Juan Pablo Isaza Report

0

Solución:

Compruebe esta solución. Espero que funcione.

$(documento).on('draw.dt','.dataTable', function() {

 $(".dataTables_filter input").off().on("input keyup", function(e) { // if value length is greater than 3 or user press enter (keycode = 13) on search we will search on datatable if(this.value.length >= 3 || e.keyCode == 13 || this.value == "") { var checkBackspaceEnter = e.keyCode == 8 || e.keyCode == 13; // if user remove character from search we will search var checkAlphabet = (e.keyCode >= 58 && e.keyCode <= 90); // check on alphabets var checkNum = (e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105); // check on number values var ctrlCombine = (e.keyCode == 17 || ((e.keyCode == 65 || e.keyCode == 67 ) && e.ctrlKey)); // donot search when user hit Ctrl+A or Ctrl+C checkAlphabet = ((ctrlCombine == false) ? checkAlphabet : false); if ( checkAlphabet || checkNum || checkBackspaceEnter) { var dataTable = $('.table').DataTable(); dataTable.search(this.value).draw(); } } });

});

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!