Jquery 表格排序不适用于输入复选框

Jquery tablesorting not working with input checkbox

我正在使用 Jquery table-sorter,它适用于所有情况,除非其中一列是输入复选框。当存在输入复选框时 table sort.I 中列的 none 已尝试将输入更改为按钮,但我无法选中该复选框(我认为这可能与标签标签有关)但列确实排序。

我到处搜索解决方案,但找不到,任何帮助将不胜感激。

<div class="container">
        <div class="row">
            <div class="cols s12">

                <div id="searchtable1">     
                    <table class="sortable responsive-table bordered highlight">        
                    <thead>         
                        <tr>
                            <th ></th>                      
                            <th >Username</th>
                            <th >First Name</th>
                            <th >Last Name</th>                     
                        </tr>   
                    </thead>                        
                    <tbody>   
                        <tr id="${count}">
                            <td>
                                <%-- <input type="checkbox" value="1" id="checkbox1" name="checkbox1"> --%>
                                <button type="checkbox" value="1" id="checkbox1" name="checkbox1"></button>
                                <label for="checkbox1"></label>

                            </td>
                            <td></td>
                            <td></td>     
                            <td></td> 
                        </tr>
                    </tbody> 
                </table>
            </div>
        </div>
    </div>
</div>


<script language="JavaScript" type="text/javascript">
    $(document).ready(function () {
        $('#searchtable1').dataTable().sort();
    });
</script>

这是一个 jsp 页面,我正在使用 CSS 实体化样式 sheet。

如果您能告诉我为什么按钮复选框不起作用或为什么输入复选框没有对 table 进行排序,那就太好了。

经过许多小时的苦难,问题出在 CSS 实体化样式 sheet 中。它不起作用,因为 <td></td> 不在同一行上。所以正确的代码和间距是:

<tr id="${count}">
    <td><input type="checkbox" value="1" id="checkbox1" name="checkbox1"><label for="checkbox1"></label></td>
    <td></td>
    <td></td>     
    <td></td> 
</tr>