Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
select all on checkbox is not working using jquery

Clicking on select all of the checkbox only the particular page is selected .not selecting all pages. Here using jquery. Datatable contains 100s of pages and using that data graph plotting is performed. The data is dynamically loaded. Data in the data table is dynamically loaded.

$('#select-checkbox').on ('click', function (e) {         
    var rows = mytab.rows({'search': 'applied'}).nodes();     
    $('input[type="checkbox"]', rows).prop('checked', this.checked);
          
    if (this.checked) {
        var data = mytab.rows({'search': 'applied'}).data();
        $('input[type="checkbox"]:checked',rows).map(function() {
            var $row = $(this).closest('tr');
            var rw=mytab.row($row).data();
            var $td = $(this).closest('td');
            var rd = mytab.cell($td).data();  
            
            mytab1.row.add(rw).draw();
            Selected_Param_Link.push(rd);    
        });
     } else {
        mytab1.rows().remove().draw();
        Selected_Param_Link = [];
     }
});

// Handle click on checkbox to set state of "Select all" control
$('#hd1 tbody' || '#fv tbody').on('change', 'input[type="checkbox"]', function () {
    // If checkbox is not checked
    if (!this.checked) {
        var el = $('#select-checkbox').get(0);
        
        // If "Select all" control is checked and has 'indeterminate' property
        if (el && el.checked && ('indeterminate' in el)) {
            // Set visual state of "Select all" control
            // as 'indeterminate'
            el.indeterminate = true;
        }
     }
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this

$(document).ready(function(){
    function addOnHandler(elem){
      
      elem.on ('click', function (e) {         
      let rows = mytab.rows({'search': 'applied'}).nodes();     
      $('input[type="checkbox"]', rows).prop('checked', this.checked);
          
      if (this.checked) {
          let data = mytab.rows({'search': 'applied'}).data();
          $('input[type="checkbox"]:checked',rows).map(function() {
              let $row = $(this).closest('tr');
              let rw=mytab.row($row).data();
              let $td = $(this).closest('td');
              let rd = mytab.cell($td).data();  
              mytab1.row.add(rw).draw();
              Selected_Param_Link.push(rd);    
          });
       } else {
          mytab1.rows().remove().draw();
          Selected_Param_Link = [];
       }
    }//addOnHandler

// Handle click on checkbox to set state of "Select all" control
    $('#hd1 tbody' || '#fv tbody').on('change',    'input[type="checkbox"]', function () {
    // If checkbox is not checked
    if (!this.checked) {
        let el = $('#select-checkbox').get(0);
        addOnHandler(el);
        
        // If "Select all" control is checked and has 'indeterminate' property
        if (el && el.checked && ('indeterminate' in el)) {
            // Set visual state of "Select all" control
            // as 'indeterminate'
            el.indeterminate = true;
        }
     }
   });

});

 

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda