我使用修改后的快速搜索和来自该站点的重置按钮:
这是我的代码:
<script type="text/javascript">
$(document).ready(function () {
$('table#MainContent_GV1 tbody tr').quicksearch({
reset: true,
resetClass: "resetButton",
resetLabel: "Reset",
position: 'before',
attached: 'table#MainContent_GV1',
stripeRowClass: ['odd', 'even']
});
$(".qs_input").focus();
});
它正在工作,但也在搜索和隐藏gridview
. 其他解决方案说添加tr
之后tbody
只搜索行而不搜索标题。这不起作用,因为标题也生成为一行(tr):
如何从搜索中排除标题?我可以为标题设置一个 ID 并使用.not
或其他 jquery 命令以某种方式排除它吗?谢谢
解决方案:
通过在第一行(标题)中添加一个元素找到了解决方案:
$('<thead></thead>').prependTo('table#MainContent_GV1').append($('table#MainContent_GV1 tr:first'));