var $lastCell = null;
var mergeCellSelector = ".c-date";
$("#scoreboard tbody td.c-date").each(function () {
if ($lastCell && $lastCell.text() == $(this).text()) {
$lastCell.closest("tr").children(mergeCellSelector)
.each(function () {
this.rowSpan = (this.rowSpan || 1) + 1;
});
$(this).closest("tr").children(mergeCellSelector).remove();
}
else
$lastCell = $(this);
var mergeCellSelector = ".c-date";
$("#scoreboard tbody td.c-date").each(function () {
if ($lastCell && $lastCell.text() == $(this).text()) {
$lastCell.closest("tr").children(mergeCellSelector)
.each(function () {
this.rowSpan = (this.rowSpan || 1) + 1;
});
$(this).closest("tr").children(mergeCellSelector).remove();
}
else
$lastCell = $(this);
});
scoreboard 是table.id
c-date是要合并的td的class
这个td也是要合并的主key