jquery - 使用jquery单击复选框内的列时添加行跨度
问题描述
我有一张像
此表在第一列中有一个复选框。当我单击复选框时,表格将如下所示。
以下代码将行跨度添加到表列但内容没有改变。
var previous = null, cellToExtend = null, rowspan = 1;
$j(".positions-table").find("td:nth-child(3)").each(function(index, e){
var jthis = $j(this), content = jthis.text();
if (previous != null && $j.inArray(index, self.firstColumnBrakes) === -1) {
// hide the row instead of remove(), so the DOM index won't "move" inside loop.
jthis.addClass('hidden');
cellToExtend.attr("rowspan", (rowspan = rowspan+1));
}else{
// store row breaks only for the first column:
if(i === 1) self.firstColumnBrakes.push(index);
cellToExtend = jthis;
previous = content;
}
});
解决方案
推荐阅读
- vb.net - 作为后台工作程序运行时工作代码失败
- android - 如何在 Gradle 插件中将 `project.android` Groovy 语法转换为 Kotlin
- matlab - 在 Matlab 中实现 Shekel 函数
- reactjs - React:你可能需要一个合适的加载器来处理这个文件类型
- android - 增加 MaxRecycledViews 对 Recyclerview 性能有影响吗?
- python - 有没有办法确定给定字节数据的格式
- r - 如何提取R中括号内的文本?
- reactjs - 跨域请求被阻止 React Golang
- javascript - 我在设置 Flatlist numColumn >=2 时遇到问题,引发违规错误
- java - 为什么 Optional 继续说我的 List 为空?