-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pager: fixed height problems. #729
Comments
Hi @doveyg! Yes, I wasn't sure how to handle child rows within the pager. Do you think it's a good idea to have a solitary child row visible at the top of a page? Wouldn't that be bad UI? I am completely open to discussion on this topic. As for filtering and maintaining a fixed height, that does appear to be an issue. I'll add it to my to-do list. |
No, I don't think that's good design. It would create distance between what was selected and what is shown, perhaps another idea would be to open a floating style tooltip in place of the next row/footer. Without actually seeing what it would look like I don't know for sure if it would be better a different way. |
The only solution I can think of right now would be to copy the parent & child rows into a separate area. Something like this demo: $(function () {
var $table = $('.tablesorter');
$table.tablesorter({
theme: 'blue',
// this is the default setting
cssChildRow: "tablesorter-childRow",
// initialize zebra and filter widgets
widgets: ["zebra", "filter", "pager"],
widgetOptions: {
// include child row content while filtering, if true
filter_childRows: true,
// class name applied to filter row and each input
filter_cssFilter: 'tablesorter-filter',
// search from beginning
filter_startsWith: false,
// Set this option to false to make the searches case sensitive
filter_ignoreCase: true
}
})
.tablesorterPager({
container: $('.pager'),
output: '{startRow} - {endRow} / {filteredRows} ({totalRows})',
removeRows: false,
});
// hide child rows
$('.tablesorter-childRow td').hide();
// Toggle child row content (td), not hiding the row since we are using rowspan
// Using delegate because the pager plugin rebuilds the table after each page change
// "delegate" works in jQuery 1.4.2+; use "live" back to v1.3; for older jQuery - SOL
$table.delegate('.toggle', 'click', function () {
var $clone = $table.clone(),
$cTbody = $clone.find('tbody').empty(),
$target = $(this).closest('tr');
// table copy should not appear sortable
$clone.find('thead').children().children()
.addClass('sorter-false');
// copy parent & child rows into copy
$target
.add( $target.nextUntil('tr.tablesorter-hasChildRow') )
.clone()
.appendTo( $cTbody )
.find('td').show();
$('.showChild').empty().append( $clone );
return false;
});
}); But I don't think this should be a choice I force on to the developers. |
I agree, but I feel a default should be provided for child-row manipulation and another option to show/hide child rows on load, the options should be provided whereby you are able to replace the default behavior with user defined functions. |
This patch 3c0380c fixes the I'll work on the child-row part of this issue soon. |
I feel like I'm making you do too much work, I think I have discovered another issue.
|
|
|
|
This fix is now available in v2.18.0. |
I have noticed two issues,
The first is related to child rows, when hiding and showing child rows the height changes, I don't know of a good solution for this the only thing I can think of is hiding the bottom visible row, this causes problems if there are multi-child rows or if the user expands the bottom row. It could also remove a child-row's visibility if the bottom rows child is expanded when the user expands a row above.
The last issue is that when filtering results/rows the fixed height option on the pager is completely ignored. I assume this is because the fixed table height is set when the pager is called and is not read when filtering.
I have removed the fixed height option from my code and will include it again when it behaves more consistently.
The text was updated successfully, but these errors were encountered: