Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

251
Visualizações
hide row on a datatable where the content is null in jquery

This is my ajax datatable. Now I can get the values on data table, and assigned the value is null when there isn't any matching condition. But What I need is, Have to hide the rows where there isn't any data or null value. If I remove the else condition getting an error as "requesting unknown parameter on column 0 row1..."

$('#retail-modal-retail-price-history').DataTable({
   data: record.retail_history,  
   destroy: true,
   searching: false,
   ordering: false,
   dom: '<<"row"<"col">>t<"row"<"col">>>',
   columns: [     
     {
         data: "price",
         'render': function (data, type, row, meta){
            if(row.TYPE==='re'){               
               return data/100;
              } 
              else
              return null;              
         } 
      
      },
      { 
         data: "scheduled_from",
         'render': function (data, type, row, meta){
            if(row.TYPE==='re'){
               
               return data;
              }   
              else
              return null;                
         }
      
      
      },
      ],

    
});

enter image description here

Want to hide the row which is coming at last. I can be able to achieve it by simply calling the below function.

$('#retail-modal-retail-price-history tr').each(function() {
   if ($(this).find('td:empty').length) $(this).remove();
});

But I understand, this is not a good solution. If there are any optimized way to do it

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda