0
I wonder if it is possible to manipulate the research of tablesorter
?
I have a list with several records and pages, but when I have searched, it is only searched by the page.
How do I search across the table?
Follows the code of tablesorter
:
<script>
$(function(){
$('table > tbody > tr:odd').addClass('odd');
$('table > tbody > tr').hover(function(){
$(this).toggleClass('hover');
});
$('#marcar-todos').click(function(){
$('table > tbody > tr > td > :checkbox')
.attr('checked', $(this).is(':checked'))
.trigger('change');
});
$('table > tbody > tr > td > :checkbox').bind('click change', function(){
var tr = $(this).parent().parent();
if($(this).is(':checked')) $(tr).addClass('selected');
else $(tr).removeClass('selected');
});
$('form').submit(function(e){ e.preventDefault(); });
$('#pesquisar').keydown(function(){
var encontrou = false;
var termo = $(this).val().toLowerCase();
$('table > tbody > tr').each(function(){
$(this).find('td').each(function(){
if($(this).text().toLowerCase().indexOf(termo) > -1) encontrou = true;
});
if(!encontrou) $(this).hide();
else $(this).show();
encontrou = false;
});
});
$("table").tablesorter({
dateFormat: 'uk',
sortList: [[0,0], [1,0]]
})
.tablesorterPager({container: $("#pager")})
.bind('sortEnd', function(){
$('table > tbody > tr').removeClass('odd');
$('table > tbody > tr:odd').addClass('odd');
});
});
</script>
I’ve never used it, but take a look at the documentation, it might help: http://tablesorter.com/docs/
– Miguel
there’s nothing in the documentation about that.
– Ailime Davis
I haven’t solved it yet. Does anyone know how? Thank you.
– Ailime Davis
You can see here: http://tablesorter.com/docs/example-parsers.html. I’ve never done anything with this plugin, I can’t help. If you are free to do so, you can always try another plugin, e.g.: https://datatables.net/
– Miguel
I tried to use datatables but it seemed very confusing, I could not change the layout to suit mine. Can you tell me if you can modify layout?
– Ailime Davis
Only with JS, you have to see in the console what elements you want to change and after calling the function that creates the table and that you can change. http://answall.com/questions/147413/%C3%89-poss%C3%advel-execute-commands-css-in-javascript-html/147415#147415
– Miguel