87,907
社区成员
发帖
与我相关
我的任务
分享
function ForEachVisibleCell(tableRow, selector, rowIndex, cellcallback) {
if (defaults.ignoreRow.indexOf(rowIndex) == -1) {
$(tableRow).find(selector).each(function (colIndex) {
if (defaults.ignoreColumn.indexOf(colIndex) == -1) {
if (typeof (cellcallback) === "function") {
var cs = 0; // colspan value
// handle previously detected rowspans
if (typeof rowspans[rowIndex] != 'undefined' && rowspans[rowIndex].length > 0) {
for (c = 0; c <= colIndex; c++) {
if (typeof rowspans[rowIndex][c] != 'undefined') {
cellcallback(null, rowIndex, c);
delete rowspans[rowIndex][c];
colIndex++;
}
}
}
// output content of current cell
cellcallback(this, rowIndex, colIndex);
// handle colspan of current cell
if ($(this).is("[colspan]")) {
cs = $(this).attr('colspan');
for (c = 0; c < cs - 1; c++)
cellcallback(null, rowIndex, colIndex + c);
}
// store rowspan for following rows
if ($(this).is("[rowspan]")) {
var rs = parseInt($(this).attr('rowspan'));
for (r = 1; r < rs; r++) {
if (typeof rowspans[rowIndex + r] == 'undefined')
rowspans[rowIndex + r] = [];
rowspans[rowIndex + r][colIndex] = "";
for (c = 1; c < cs; c++)
rowspans[rowIndex + r][colIndex + c] = "";
}
}
}
}
});
}
}