diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-06-15 22:23:26 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-06-15 22:23:26 +0200 |
commit | 34809379563a6fc92889965441c56ba29c155947 (patch) | |
tree | 532d26edab9f88bf67d888f9e4c23cfde33cf4b6 /ratatoeskr/js | |
parent | 04b47bc50dd147ad2156a29bdb274049f99d9bce (diff) | |
download | ratatoeskr-cms-34809379563a6fc92889965441c56ba29c155947.tar.gz ratatoeskr-cms-34809379563a6fc92889965441c56ba29c155947.tar.bz2 ratatoeskr-cms-34809379563a6fc92889965441c56ba29c155947.zip |
Filters in backend are now dynamic.feature-ui-improvements
If JavaScript is activated in the users browser, filterable tables are
filtered immediatly.
Diffstat (limited to 'ratatoeskr/js')
-rw-r--r-- | ratatoeskr/js/backend.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ratatoeskr/js/backend.js b/ratatoeskr/js/backend.js index d131bfe..43e2544 100644 --- a/ratatoeskr/js/backend.js +++ b/ratatoeskr/js/backend.js @@ -16,4 +16,42 @@ $(function() $("div.articleeditor-metabar-element-content", self.parent()).show("fast"); } }); + + function filtertable(table, pairs) + { + $.each(pairs, function(idx, pair) + { + input = pair[0]; + column = pair[1]; + + (function(column){input.keyup(function() + { + filterby = $(this).val().toLowerCase(); + $("tbody tr", table).each(function(i) + { + if($("td", this).eq(column).text().toLowerCase().indexOf(filterby) == -1) + $(this).hide() + else + $(this).show(); + }); + });})(column); + }); + } + + $("#articlestable").each(function(i) + { + filtertable( + $("table", this), + [ + [$("input[name=filter_urlname]", this), 1], + [$("input[name=filter_tag]", this), 4], + [$("input[name=filter_section]", this), 5] + ] + ); + }); + + $("#commentstable").each(function(i) + { + filtertable($("table", this), [[$("input[name=filter_article]", this), 7]]); + }); });
\ No newline at end of file |