Problem
When viewing large tables of data via a web interface, it's often
desirable to limit the visible rows to a single column's value. This
can be done very efficiently through backend coding, but can require
knowledge of programming languages and more access to a server
environment than many users have or want.
In the case where the data set is large enough to be unwieldy, but not
so large or business-critical to need a multi-tiered system to manage
this filtering, it may be good enough to just do all filtering on the
client side.
Unobtrusive DHTML
While today's web design tends to shy away from tables, they remain
the simplest way to display a legitimate table of data, be it static
hand-coded HTML or simple views into a database.
A major driving goal in building the TableFilter code was to allow the
filtering functionality to work on a normal HTML table, while
requiring nothing more of the HTML writer than the addition of an ID
to the table and a very small snippet of JavaScript.
This JavaScript also will not cause breakage of standard DHTML
functionality on browsers which do not support JavaScript at all. The
filtering functionality won't be added, obviously, but at least the
table will display as it always has.
Acknowledgements
Thanks to
Stuart Langridge for his very useful
sorttable JavaScript. I've used this for quick
& dirty admin tools quite a few times now, and it inspired me to write
this as a companion script.