This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function combineEqual(rows, aryChk) { | |
var rowOdd = rows.filter(':odd'); | |
var rowEven = rows.filter(':even:gt(0)'); //排除標題列 | |
//大於1列,且列的總數量要為奇數(含標題列) | |
if ((rows.length > 1) && (rows.length % 2 === 1)) { | |
for (var i = 0; i < rowOdd.length; i++) { | |
var cellV0 = $(rowOdd[i]).find('td'); //v0列全部cell | |
var cellV1 = $(rowEven[i]).find('td'); //v1列全部cell | |
//比對version 0 & 1(最後一欄),AccountID(第2欄)要相等 | |
if ((cellV0[cellV0.length - 1].innerHTML === '0') && (cellV1[cellV1.length - 1].innerHTML === '1') && (cellV0[1].innerHTML === cellV1[1].innerHTML)) { | |
aryChk.map(function(i) { | |
//內容相同,就合併 | |
if (cellV0[i].innerHTML === cellV1[i].innerHTML) { | |
cellV0[i].rowSpan = 2; | |
$(cellV1[i]).remove(); | |
} | |
}); | |
} | |
} | |
} | |
} | |
combineEqual($('#GridView1 tr'), [0, 1, 2, 3, 4]); |