/** * jQuery Plugin: Table Filter - version 0.1.1 * Insert a input form for filtering rows dinamically. * * Copyright (c) 2009 Kyo Nagashima * This library licensed under MIT license: * http://opensource.org/licenses/mit-license.php * * Usage: * Insert to all table * $("table").addTableFilter(); * * Insert to "#table1" only * $("#table1").addTableFilter(); * * Insert with custom label text and size * $("table").addTableFilter({ * labelText: "Filtering Words: ", * size: 48 * }); * * Styling: * You can style inserted elements like this: * .formTableFilter { * text-align: right; * } * * .formTableFilter label { * font-weight: bold; * } * * .formTableFilter input { * border: 1px solod #999999; * width: 12em; * color: #ffffff; * background-color: #333333; * } */ (function($) { $.fn.addTableFilter = function (options) { var o = $.extend({}, $.fn.addTableFilter.defaults, options); if (this.is("table")) { // Generate ID if (!this.attr("id")) { this.attr({ id: "t-" + Math.floor(Math.random() * 99999999) }); } var tgt = this.attr("id"); var id = tgt + "-filtering"; // Build filtering form var label = $("