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

103
Visualizações
prevent deselect when click selected row in bootstrap table

I have a webapp in HTML5, using bootstrap table. I have set "data-click-to-select="true" to check the checkbox when select the row.

But when click some dropdown to box in this row, the check box become unselected.

How to prevent the unselect event when click the selected row?

<table contenteditable='true' class="table table-bordered table-sm" width="100%" cellspacing="0" style="font-size: 1.0rem;"
                   id="bk-table"

                   data-click-to-select="true"
                  <tr >
 
                    <th data-field="state" data-checkbox="true"></th>
                    <th data-field="courseCode"  data-formatter="renderCourse">Course Code</th>
<th  data-field="book.Distribution_platform" data-formatter="renderMode">Distribution Mode</th>
         ...
                </tr>
                </thead>
</table>
<script>
        function renderMode(value) {
            return `<select style="width: 7em"class ='Distribution_platform' name="Distribution_platform" id="Distribution_platform">
            <option value="" ${(value === '') ? 'selected="selected"' : ""}>--Select--</option>
            <option value="Canvas" ${(value === 'Canvas') ? 'selected="selected"' : ""}>Canvas</option>
            <option value="Main Distribution" ${(value === 'Main Distribution') ? 'selected="selected"' : ""}>Main Distribution</option>
        </select>`
        }

</script>

I have tried:

          function ignoreClickToSelectOn(e) {
    return ['A', 'BUTTON', 'LABEL', 'SELECTION'].indexOf(e.tagName) > -1
  }

  $(function() {
    $('#bk-table').bootstrapTable({
      ignoreClickToSelectOn: ignoreClickToSelectOn
    })
  });

          $('#bk-table').on('click-row.bs.table', function (event, row) 
     {

        event.stopImmediatePropagation();
        event.stopPropagation();
        event.preventDefault();

    });

But these all could not prevent the uncheck event of the checkbox.

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