Loading...
 

jQuery tablesorter pager at the bottom does not show initially

Status
Open
Subject
jQuery tablesorter pager at the bottom does not show initially
Version
18.x
19.x
Category
  • Bug
Feature
Tablesorter
Resolution status
New
Submitted by
Philippe Cloutier
Lastmod by
Philippe Cloutier
Rating
(0)
Description

jQuery tablesorter allows to control the maximum number of rows to display in a table. When the number of data records exceeds that maximum, the pager widget or the pager plugin paginates the data on multiple pages. tablesorter, for example on tiki-listpages.php, therefore displays a pager area which at the top of each table. This area provides controls to change the maximum number of rows in a page and to select the page to display, as can be seen in the attached screenshot.

This area can not only display at the top of tables, but also at the bottom, so that when one scrolls through a dataset from start to finish, there is no need to go back to the top to continue to the next page. There is however an optimization so that the pager does not display twice at the same time in the viewport. lib/core/Table/Code/Bind.php line 33-39 (in Tiki 18) either show or hide the bottom pager:

if (this.config.pager.endRow - this.config.pager.startRow > 15) {
			$('div#listpages1-pager.ts-pager-bottom').css('display', 'block');
		} else {
			$('div#listpages1-pager.ts-pager-bottom').css('display', 'none');
		}


This is based on a rule of thumb which estimates that a viewport fits 15 rows. When browsing 70 records and viewing records 1 to 25, endRow has the value 25 and startRow has the value 0, so the difference between the 2 is 25, which is more than 15. Therefore, the bottom pager's div is displayed.

This code is run whenever the pager is used, plus at page load. The code works fine once the page has finished loading, but on page load, it is unfortunately fragile. When this code is first run, endRow has the value 0, so the difference is always 0 and display is always set to none. The initial display is fine in Tiki 15 up to 17 because this code (which runs when the tablesorter-ready event occurs) runs several times during page load, and endRow has the correct value the last time the code runs. In Tiki 18 the code only runs once per page load. This would be a good thing for performance, except that this one run is unfortunately too early, so the difference is always 0.

As I verified Tiki's related code seems unchanged between Tiki 17 and 18, I imagine this regression comes from the upgrade of jQuery tablesorter from 2.28.5 to 2.31.1. This persists in Tiki 19, and in trunk as of r70207.

Solution
The ideal fix would be to run the code once at the right time. The exact point from which the handler will work is after the tablesorter filter widget has finished initializing. So this could be fixed by triggering tablesorter-ready after
tsf.filterInitComplete( c );
in the filter widget's completeInit function. Unfortunately, that would require modifying a vendor file (vendor_bundled/vendor/mottie/tablesorter/js/jquery.tablesorter.combined.js), so that's not really cleaner unless it can be done upstream.
Workaround
The attached patch fixes with a failsafe that displays the bottom pager when the handler is unable to determine whether it should display or not.
Importance
3
Easy to solve?
5
Priority
15
Demonstrate Bug
Please demonstrate your bug on show2.tikiwiki.org

 About show2.tikiwiki.org

To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tikiwiki.org instance. To start, simply select a version and click on "Create show2.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tikiwiki.org.

Version: Create show2.tikiwiki.org instance
Rating (deprecated)
(1)
Ticket ID
7097
Created
Monday 17 June, 2019 20:39:19 GMT-0000
LastModif
Tuesday 18 June, 2019 17:01:58 GMT-0000

Attachments

 filenamecreatedhitscommentversionfiletype 
tablesorter_display_bottom_pager.diff 17 Jun 19 20:40 GMT-00000
tablesorter pager.png 17 Jun 19 20:40 GMT-00000


Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Group
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
Theme
TikiTests
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools