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

244
Visualizações
On check box change value of the text box in datatable

I am using datatable. where I am doing sum of the all the data in same column

Here is my code

                {
                    title: "New Price", data: "price",
                    "render": function (data, type, row) {


                        return ' <input type="checkbox" value="' + data + '" >
 <input type="number" id="newCost"  class ="price-input"  value="' + data + '" style="background-color:lightgoldenrodyellow;">';

                    }

        function doSum5() {
           
            var nodes = table7.column(3).nodes();
            // get the value from each input field in each cell:
            var total = table7.column(3).nodes()
                // and then sum up the integer values:
                .reduce(function (sum, node) {
                    return sum + parseFloat($(node).find('input').val());
                }, 0);
            // place the sum in the relevant footer cell:
            var sum = parseFloat(total).toFixed(2)
            $(table7.column(3).footer()).html(sum);


        }

enter image description here

Code is working fine, Now my question is how it is possible that only those fields will be selected for the sum which is checked for the checkbox. please guide me

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