X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/1d2faf9cbd58546ac4a44f085fe1910971882f7f..a3ffb22a8e1234cc85cd1d098ed9ff70cac5c51e:/searchlocal.js diff --git a/searchlocal.js b/searchlocal.js index 8c33f8d..752a3ee 100644 --- a/searchlocal.js +++ b/searchlocal.js @@ -29,20 +29,16 @@ function filtercell(el, set, action) { } function filtercols(table, match, action) { - var matchloc; + var matchloc = []; for (var y = 0; y < table.rows.length; y++) { var loc = 0; for (var x = 0; x < table.rows[y].cells.length; x++) { var cell = table.rows[y].cells[x]; - if (y == 0) { - if (match(cell)) { - if (!matchloc) matchloc = [loc]; - matchloc[1] = loc + cell.colSpan; - filtercell(table.children.item(x), true, action); // colgroup - } + if (y == 0 && match(cell)) { + for (var i = loc; i < loc + cell.colSpan; i++) matchloc[i] = true; + filtercell(table.children.item(x), true, action); // colgroup } - var keep = matchloc && loc >= matchloc[0] && loc < matchloc[1]; - filtercell(cell, keep, action); + filtercell(cell, matchloc[loc], action); loc += cell.colSpan; } }