bootstrap框架中怎么让table中显示checkbox?

bootstrap框架中怎么让table中显示checkbox?,第1张

bootstrap框架中让table中显示checkbox的具体的方法步骤如下:

<script>

$(function () {

$("#checkAll").click(function () {

$("input[name='imgVo']:checkbox").prop("checked", this.checked)

})

})

</script>

<table class="table table-hover" style="width: 45%">

<thead>

<tr>

<th><input type="checkbox" id="checkAll"/></th>

<th>#</th>

<th>文件名</th>

<th>修改时间</th>

<th> *** 作</th>

</tr>

</thead>

<tbody>

<c:forEach var="imgVo" items="${page.list}" varStatus="st">

<tr>

<td><input type="checkbox" name="imgVo" value="${imgVo.fileName}"/></td>

<td>${st.count}</td>

<td>${imgVo.fileName}</td>

<td><fmt:formatDate value="${imgVo.modifyTime}" pattern="yyyy-MM-dd hh:mm:ss"/></td>

<td><a href="${ctx}/uploadimg/show/${imgVo.fileName}"  target="_blank">查看</a>

<a href="${ctx}/uploadimg/downloads/${imgVo.fileName}">下载</a>

</td>

</tr>

</c:forEach>

</tbody>

</table>

更正你一个常识性的问题,由于checkbox是可见的控件,而dataTable是不可见的虚拟表,所以checkbox是不能添加到dataTable里的。

可能你的dataTable是通过ListView或DataGridView显示出来的,你想把checkbox放在listView/DataGridView中

ListView中添加checkbox比较便捷,直接修改ListBox属性checkBoxes为true即可

如果是在dataGridView中添加就比较难控,而且复杂,这里有示例:

http://blog.csdn.net/lbqhope/article/details/5997711

else if (iCol >2 &&iCol <= rst.colModel.length &&iCol % 2 == 0) {

var table = jQuery("#list_info")

var tdObject = $("#" + rowid + ">td:nth-child('" + (iCol + 1) + "')")

tdObject.html('<input type="checkbox" name="listenClass"/>')

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/7908019.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-11
下一篇 2023-04-11

发表评论

登录后才能评论

评论列表(0条)

保存