jquery 动态表格合并
2017-05-18 17:02
441 查看
$.fn.extend({
//表格合并单元格,colIdx要合并的列序号,从0开始
"rowspan": function (colIdx) {
return this.each(function () {
var that;
$('tr', this).each(function (row) {
$('td:eq(' + colIdx + ')', this).filter(':visible').each(function (col) {
if (that != null && $(this).html() == $(that).html()) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(this).hide();
} else {
that = this;
}
});
});
});
}
});
$("#testlist").rowspan(1); //第一列合并
//表格合并单元格,colIdx要合并的列序号,从0开始
"rowspan": function (colIdx) {
return this.each(function () {
var that;
$('tr', this).each(function (row) {
$('td:eq(' + colIdx + ')', this).filter(':visible').each(function (col) {
if (that != null && $(this).html() == $(that).html()) {
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) {
$(that).attr("rowSpan", 1);
rowspan = $(that).attr("rowSpan");
}
rowspan = Number(rowspan) + 1;
$(that).attr("rowSpan", rowspan);
$(this).hide();
} else {
that = this;
}
});
});
});
}
});
$("#testlist").rowspan(1); //第一列合并
相关文章推荐
- <jquery>jquery动态合并表格
- jquery 动态合并表格
- jquery动态合并表格行
- jquery动态创建表格插件
- JQuery将DataTable list<>数据转换成JSON数据 动态创建表格显示数据
- 小女子需要各位博友帮忙—— 一个关于JS 动态表格合并拆分问题
- php动态生成表格的合并
- 用jQuery合并表格中相同文本的相邻单元格(一)
- 我的jQuery动态表格插件(转)
- jquery + json 动态创建复杂表格table
- JQuery动态生成Table表格
- jQuery - 参考资料 - How to Build Tables Dynamically:如何动态构建表格
- 用jQuery合并表格中相同文本的相邻单元格
- 我的jQuery动态表格插件
- JQuery将DataTable list<>数据转换成JSON数据 动态创建表格显示数据
- 最近使用jquery比较多,网上搜了很多有用的东西,先记下来!(1.动态添加表格行, 2.下拉框联动)
- 用jQuery合并表格中左侧表头同列相同文本的相邻单元格
- 用jQuery合并表格中相同文本的相邻单元格(一)
- 应用jQuery实现表格数据的动态添加与统计