3 /* set or clear the ' invisibleRow' in the tr's classname, according to visible */
4 function plc_table_row_visible (row,visible) {
7 cn=cn.replace(" invisibleRow","");
8 if (! visible) cn += " invisibleRow";
12 // /* scan the table, and mark as visible the rows that have at least one cell that contains the pattern */
13 function plc_table_filter (table_id,pattern_id) {
14 var rows = document.getElementById(table_id).getElementsByTagName("tbody")[0].rows;
15 var pattern_text = document.getElementById(pattern_id).value;
16 var row_index, row, cells, cell_index, cell, visible;
19 // remove whitespaces at the beginning and end
20 pattern_text = pattern_text.replace(/[ \t]+$/,"");
21 pattern_text = pattern_text.replace(/^[ \t]+/,"");
23 var patterns = pattern_text.split(" ");
25 for (row_index = 0; row=rows[row_index]; row_index++) {
27 /* xxx deal with empty patterns and whitespaces */
28 if (patterns.length == 0) {
33 for (cell_index = 0; cell=cells[cell_index]; cell_index++) {
36 if (cell.innerHTML.match(pattern)) visible=true;
40 plc_table_row_visible(row,visible);
42 tablePaginater.init(table_id);
45 function plc_table_filter_reset (table_id, pattern_id) {
47 document.getElementById(pattern_id).value="";
48 plc_table_filter (table_id, pattern_id);