table表格合并封装的小插件
2017-02-07 15:09
921 查看
/**
* 封装的一个JQuery小插件
* @param {Object} colNo
* @memberOf {TypeName}
* @return {TypeName}
*/
jQuery.fn.rowspan = function(colNo) {
return this.each(function(){
var that;
$('tr', this).each(function(row){
$('td:eq('+ colNo +')', 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;
}
});
});
});
};
* 封装的一个JQuery小插件
* @param {Object} colNo
* @memberOf {TypeName}
* @return {TypeName}
*/
jQuery.fn.rowspan = function(colNo) {
return this.each(function(){
var that;
$('tr', this).each(function(row){
$('td:eq('+ colNo +')', 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;
}
});
});
});
};
相关文章推荐
- bootstrap-table表格插件之服务器端分页实例
- table表格中,将边框合并成单线条的边框
- 自己动手丰衣足食之表格排序插件jquery.tableSort.js
- html表格cell合并插件
- 1js动态拼接表格,2获取表格内属性,并将table表格元素封装成json,3后台将json转成list
- 封装jQuery表格插件jqGrid,控件化jqGrid(二):显示
- 封装jQuery表格插件jqGrid,控件化jqGrid(三):查询,编辑,修改,删除
- 【前端H5】bootstrap-table表格插件使用js设置高度及高度自适应
- 使表格的标题列可左右拉伸jquery插件封装
- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
- table表格合并跨行中相同元素的列
- boostrap-table插件分页展示表格数据
- bootstrap 表格插件bootstrap-table的js设置高度及高度自适应
- (原创) cocos2d-x 3.0+ lua 学习和工作(4) : 公共函数(6): 合并表格:table.merge
- 一款用于表格数据自定义排序的jQuery插件jquery.tablesortable.js(附ajax例子)
- 如何使用html表格自定义或采用tableexport.js第三方插件以excel格式导出
- Vue封装的可编辑表格插件方法
- 合并table相同单元格的jquery插件(很精简)
- Bootstrap表格插件--bootstrap-table
- [置顶] table表格合并第一列中相同的内容!