Created
June 5, 2015 01:27
-
-
Save arkadiusjonczek/d62dac3e588c96cec8b1 to your computer and use it in GitHub Desktop.
WordPress TablePress: Search for text in table using anker link (filter rows)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="" class="filter_remove">Alle</a> | |
<a href="" class="filter_table">Funktion X</a> | |
<a href="" class="filter_table">Funktion Y</a> | |
<a href="" class="filter_table">Nichts</a> | |
[table id=1 /] | |
<script> | |
jQuery(document).ready(function($) { | |
$('a.filter_table').click(function(e) { | |
e.preventDefault(); | |
var key = $(this).text(); | |
$('#tablepress-1').DataTable().search(key).draw(); | |
}); | |
$('a.filter_remove').click(function(e) { | |
e.preventDefault(); | |
$('#tablepress-1').DataTable().search('').draw(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment