Search code examples
tablesorter

Tablesorter filter-onlyAvail


I use tablesorter (mottie's fork v2.23.0) by the gem jquery-tablesorter-rails

I have a table where I use the classes filter-select filter-onlyAvail to get a dropdown of only available options in the column.

Recently I added jeditable to the column which adds a script tag to the cells (and maybe also embed the value in a span) like this:

<td>                  
  <span class="editable" data-id="15" data-name="user[route]" title="Click to edit..">1</span>
  <script type="text/javascript">
    ...script for jeditable....
  </script>
</td>

The result is that the select filter dropdown shows all variants of values including the script contents.

I tried using filter_selectSource with the filter-match class added, but the contents of the filter is so common (like 1,2 99 etc) I get lots of false hits in the script.

Any pointers on how to ditch the contents of the script tags both in select population and in search results?


Solution

  • I ended up using data-text="value" on the element I want to use for filter and sorting.

    In my case the tag.

    This does not, however, update tablesorter's filter values or search content for an updated cell.