0

I use the modified quicksearch with reset button from this site:

http://michael.theirwinfamily.net/articles/jquery/modify-jquerys-quicksearch-plugin-include-reset-button

This is my code:

<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();
});

It is working but also searching and hiding the header of the gridview. Other solutions said to add the tr after the tbody to search only the rows but not the header. This is not working because the header is also generated as a row (tr):

enter image description here

how can I exclude the header from the search? Can I set an ID to the header and exclude it somehow with .not or another jquery command? Thanks

Solution:

Found the solution by adding an element in the first row (header):

$('<thead></thead>').prependTo('table#MainContent_GV1').append($('table#MainContent_GV1 tr:first'));

Community
  • 1
  • 1
Kᴀτᴢ
  • 2,146
  • 6
  • 29
  • 57
  • Chaining a `.not("#id")` to the end of your `$('table#MainContent_GV1 tbody tr')` as you said should work. Have you tested that approach? – N.J.Dawson Sep 06 '16 at 07:31
  • Thanks. Tried `$('table#MainContent_GV1 tbody tr').not("ID").quicksearch({...` and `not("#id")` but still the same problem – Kᴀτᴢ Sep 06 '16 at 07:37
  • 1
    If the following isn't working (example of it working, shown here, albeit without quicksearch) https://jsfiddle.net/e234zLco/ you could try the :not psuedo selector as seen here: https://jsfiddle.net/e234zLco/1/ Just saw your edit. Good job solving the problem. – N.J.Dawson Sep 06 '16 at 08:47

0 Answers0