【发布时间】:2014-10-11 20:54:13
【问题描述】:
我正在使用 tablesorter 插件。过滤器小部件在单个表上效果很好。现在我正在尝试用 tablesorter 做两件事。
-
我正在尝试根据下拉列表的值隐藏整个表格。我得到了以下代码的解决方案,但我想知道 tablesorter 中是否有更好的方法:
$("#search_league").change(function () { $("table").show(); $("table").each(function(){ if($("#search_league").val() != $(this).attr('id')){ $(this).hide(); }; }); }); 我觉得第二个更难。我正在尝试隐藏所有不包含特定值的表我正在使用下拉列表来选择值。所有不包含该值的表都应隐藏。
这些表是由 mysql 查询和 php.ini 创建的。这些是表头。
echo "<table class='tablesorter' id='".$lid."' style='width:80%'>
<thead>
<tr>
<th colspan='2'><a href='league.php?lid=".$lid."'>".$getlid['LEA']."</a></th>
<th class='num_caption' title='Spiele'>Sp</th>
<th class='num_caption' title='Siege'>S</th>
<th class='num_caption' title='Niederlagen'>N</th>
<th class='num_caption' title='Wertungspunkte'>WP</th>
<th class='num_caption' colspan='2' title='Korbpunkte'>Punkte</th>
<th class='num_caption' title='Differenz Korbpunkte'>Dif</th>
<th class='num_caption' title='Spiele verloren mit Spielwertung'>Wert</th>
<th style='display:none';>Team</th>
</tr>
</thead>";
我尝试解决 #1 之类的问题,但这似乎不是正确的方法。有什么想法吗?
【问题讨论】:
标签: jquery drop-down-menu filter tablesorter