Skip to content
Mottie edited this page Oct 31, 2013 · 16 revisions

Milestones: 2.13 | 2.12 | 2.11 | 2.10 | 2.9 | 2.8 | 2.7 | 2.6 | 2.5 | 2.4 | 2.2 | 2.1 | 2.0.6+ (fork created)

Pager Change Log

Version 2.13 (10/30/2013)

  • Added pager countChildRows option (plugin & widget)
    • When true, the pager treats child rows as if it were a parent row and strictly enforces showing only the set number of pager rows.
    • This can cause problems as a child row may not appear associated with its parent, may be split across pages or possibly distort the table layout if the parent or child row contain row or cell spans.
    • When false the pager always includes the child row with its parent, ignoring the set pager size.
    • See issue #396.

Version 2.12 (10/18/2013)

  • In attempts to initialize the pager after the filter widget:
    • Added a pager widget (still beta testing) to allow initializing the pager after certain widgets (filter widget).
    • Updated tablesorter core (properly count table columns) & filter widget code to allow it to initialize on an empty table (thanks @stanislavprokopov!).
    • Hopefully one or both of these changes fixes issue #388.
    • New pager widget demos: basic & ajax.
  • savePages option
    • Should no longer cause an error if stored data is malformed or unrecognized. Fixes issue #387.
    • The stored size and page is now cleared if the table is destroyed.
  • Fixed an error occuring in IE when trying to determine if a variable is an array (toString function call not recognized). Fixes issue #390.
  • Updated pager rendering to prevent multiple ajax calls.
  • During this update, the pager page size would return as zero and set the totalPages value to inifinity. Yeah, it doesn't do that anymore; but you can still set the pager size to zero if you want!

Version 2.11.1 (10/11/2013)

  • Fixed an updating bug:
    • The pager was not updating properly
    • The updateComplete event was not firing when not using ajax.
    • Thanks @sbine for sharing the fix!

Version 2.11.0 (10/10/2013)

  • Fixed the removeRows option error when set to true.
  • The pager now stores any object returned by the ajaxProcessing function in table.config.pager.ajaxData
    • The object should contain attributes for total (numeric), headers (array) and rows (array of arrays).
    • A replacement output option can also be loaded via this method and must be included in the output attribute (i.e. ajaxData.output).
    • Additional attributes are also available to the output display by using the attribute key wrapped in curly brackets (e.g. {extra} from ajaxData.extra).
    • Additional attributes can also be objects or arrays and can be accessed via the output string as {extra:0} (for arrays) or {extra:key} for objects.
    • The page number is processed first, so it would be possible to use this string {extra:{page}} ({page} is a one-based index), or if you need a different value use {page+1} (zero-based index plus any number), or {page-1} (zero-based index minus any number).
    • For more details, please see issue #326.
    • Thanks @camallen for the suggestions & feedback!
  • The "updateComplete" event should now properly trigger after an ansynchronous ajax call has completed. Fixes issue #343.
  • Added a new savePages option
    • Requires requires the $.tablesorter.storage script within the jquery.tablesorter.widget.js file to work properly.
    • When true, it saves pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js).
    • The pager will continue to function properly without the storage script, it just won't save the current page or pager size.
    • Fulfills enhancement request from issue #345.
  • Removed table update when using ajax with a server that is already doing all of the work. Fixes issue #372 & issue #361. Thanks @sbine!
  • Merged in change to count table th length after ajaxProcessing (pull #383). Thanks @harryxu!
  • Reverted changes made in pull #349 as the error row was not showing because the urls did not exactly equal each other.
  • Child rows within the pager will now properly display/hide. Fixes issue #348.
  • Merged in fix for pager redundant ajax requests (pull #336). Thanks @camallen!
  • Merged in fix for pager totalRows check (pull #324). Thanks @camallen!

Version 2.10.3 (5/27/2013)

  • Updated pager pageSize method to properly store the set page size; fixes #287.

Version 2.10 (5/8/2013)

  • Filter widget updates:

    • Added filter_filteredRow option which contains the class name added to each visible filtered row. Used by the pager to properly count filtered rows.
  • Pager addon updates:

    • Controls are now cached internally.

      • table.config.pager.$container now stores the jQuery object targeted by the pager container option.
      • table.config.pager.$goto stores the jQuery object targeted by cssGoto.
      • table.config.pager.$size stores the jQuery object targeted by cssPageSize.
    • Page size selectors should now update properly when the pageSet or pageSize methods are used.

    • The pager should now properly target the first sortable tbody (it will skip any "info-only" tbodies).

    • Fixed pagerComplete callback firing more than once while sorting or filtering. Fixes issue #291.

    • Fixed pager not updating when the filter widget reveals zero matches. Fixes issue #297.

    • The pager ajax function now does better error handling.

    • Updated the pager ajax error displayed row; including updating all themes.

    • Added ajaxObject option:

      • You can now customize how the pager plugin interacts performs its ajax functioning.

      • Modify the ajaxObject to include any of the ajax settings:

        ajaxObject: {
          dataType: 'json'
        }
      • The only option that gets overwritten is the url option. It is set by the ajaxUrl and customAjaxUrl options.

      • Fulfills issue #280.

    • Updated ajaxProcessing to now make returning rows optional, or it can now accept the rows as a jQuery object instead of an array. The addon triggers an "update" event internally, so no need to include that.

      • Return a jQuery object

        ajaxProcessing: function(data, table){
          if (data && data.hasOwnProperty('rows')) {
            var r, row, c, d = data.rows,
            // total number of rows (required)
            total = data.total_rows,
            // array of header names (optional)
            headers = data.headers,
            // all rows: array of arrays; each internal array has the table cell data for that row
            rows = '',
            // len should match pager set size (c.size)
            len = d.length;
            // this will depend on how the json is set up - see City0.json
            // rows
            for ( r=0; r < len; r++ ) {
              rows += '<tr class="ajax-row">'; // new row array
              // cells
              for ( c in d[r] ) {
                if (typeof(c) === "string") {
                  rows += '<td>' + d[r][c] + '</td>'; // add each table cell data to row array
                }
              }
              rows += '</tr>'; // add new row array to rows array
            }
            // don't attach the $(rows) because it's difficult to tell old from new data
            // and no need to trigger an update method, it's done internally
            return [ total, $(rows), headers ];
          }
        },
      • Build the table yourself (just return the total number of rows):

        ajaxProcessing: function(data, table){
          if (data && data.hasOwnProperty('rows')) {
            var r, row, c, d = data.rows,
            // total number of rows (required)
            total = data.total_rows,
            // all rows: array of arrays; each internal array has the table cell data for that row
            rows = '',
            // len should match pager set size (c.size)
            len = d.length;
            // this will depend on how the json is set up - see City0.json
            // rows
            for ( r=0; r < len; r++ ) {
              rows += '<tr class="ajax-row">'; // new row array
              // cells
              for ( c in d[r] ) {
                if (typeof(c) === "string") {
                  rows += '<td>' + d[r][c] + '</td>'; // add each table cell data to row array
                }
              }
              rows += '</tr>'; // add new row array to rows array
            }
            // find first sortable tbody, then add new rows
            table.config.$tbodies.eq(0).html(rows);
            return [ total ];
          }
        },

Version 2.9.0 (4/12/2013)

  • Updated Filter widget

    • Fixed a bug that only occurred when using the filter widget with the pager plugin getting ajax data
      • The pager no longers repeatedly tries to get the first page of table content
      • Fixes issue #270.
  • Updated Pager Plugin

    • Added all pager plugin options within the widget options table on the main documentation page.
    • Added a better example of how to use the customAjaxUrl function.
    • Updated the {page} tag used withing the ajaxUrl option:
      • Previously {page} was replaced with a zero-based index of the targetted page number, now this format can also be used {page+1}.
      • A tag of {page+1} will be replaced with the targetted page number plus one, making it a one-based index.
      • Actually any number can be added, or subtracted, from the page number using this format: {page+2}, {page-1}, {page+10}, etc.
    • The List portion of the {sortList:col} and {filterList:fcol} tag are now optional:
      • These tags are used within the ajaxUrl option.
      • So, {sort:col} and {filter:fcol} can now be used. It just seems clearer/cleaner to me.
    • The pager's ajaxProcessing function is now more flexible
      • When returning the processed ajax data, it was required to return it in this form: [ total, rows, headers ].
      • With this update, you can now also return the data as [ rows, total, headers ].
      • If your database is dynamic and doesn't have a total, then you can just give it a really big number & disable the "last" page button. The only reason the plugin needs the total is to calculate the total pages and to know what number to set when the user clicks on the last page button.

Version 2.8.1 (3/27/2013)

  • Added customAjaxUrl option to the pager:
    • This function is called after all processing has been applied to the ajaxUrl string.
    • Use this function to make any other string modifications, as desired.
    • Thanks to Cthulhu59 for contributing. See pull request #256.

Version 2.7.9 (2/20/2013)

  • Fixed an issue with the pager targetting an incorrect page when the table starts out empty.

Version 2.7.7 (2/17/2013)

  • Added a pageSet method to the pager which allows you to easily change the pager page (see issue #231):

    // go to page 3
    $('table').trigger('pageSet', 3);

Version 2.7.4 (1/29/2013)

  • Fixed an problem with the pager not pointing to a tbody, and breaking on an empty tbody. See issue #223.
  • Added pageSize method to change the pager page size more easily. See issue #218.

Version 2.7.1 (1/4/2013)

  • Fixed pager issues:
  • Pager status will now update properly while filtering rows.
  • Pager status will also update properly after sorting filtered rows.
  • The above issues were fixes for issue #207.
  • Fixed the pager's fixedHeight option to again properly pad the table to maintain the height.

Version 2.7 (12/26/2012)

  • Fixed an issue with the pager resetting to the first page after every sort.

Version 2.6.2 (12/20/2012)

  • Fixed pager ajax. It no longer load the initial page twice. Fixes issue #202.

Version 2.6.1 (12/19/2012)

  • Updated the pager
    • Added an event named pagerBeforeInitialized which is triggered after all of the controls have been set up, but before rendering of the table or ajax data is obtained.
    • Cleaned up pager code.
  • Fixed pager size result incorrect with nested tables. Fixes issue #196.

Version 2.6 (12/18/2012)

  • Improved pager AJAX support:
    • Added serverSideSorting option (default is false) to the plugin core which when true will disable client-side sorting.
    • Added filter_serversideFiltering filter widget option (default is false) which when true will disable client-side filter widget processing.
    • Added a filterList ({filterList:fcol}) ajax parameter to the pager's ajaxUrl option.
    • Added cssErrorRow option to the pager options, allowing you to style the ajax error row which only appears with ajax errors.
    • This update also fixes an issue with page size changing. See issue #198.
    • Thanks to dhamma for this enhancement!

Version 2.5.2 (11/27/2012)

  • Fixed an issue with the pager making recursive ajax calls. Fixes issue #182.

Version 2.4.8 (11/15/2012)

  • Fixed a few issues:
    • The pager plugin will no longer cause a javascript error when initialized on a table that doesn't have tablesorter applied.
    • The sticky header widget will now add the cloned table with the sticky header AFTER the table, in case the table has an ID applied.
    • See issue #175 for more details.
  • Fixed an issue with the cssPageSize and cssGoto not becoming disabled when multiple elements exist. Fixes issue #157.

Version 2.4.6 (10/25/2012)

  • Filter widget select dropdowns will now trim extra spaces before adding them as an option. Fixes issue #161.
  • Fixed pager addon page size selector. There is an order of priority:
    • If an option has selected="selected" as an attribute, it will override the pager size option.
    • Pager size option is no longer ignored even if no option in the page size select is selected.
    • Fixes an problem brought up in issue #122.
  • The pager plugin will now update when an updateComplete or filterEnd event is triggered on the table.
    • Added to make the pager plugin work with this quicksearch plugin.
    • To make them work together, filtered rows need to get a class name of filtered before triggering the updateComplete event.
    • See issue #160 for more details.

Version 2.4.5 (10/17/2012)

  • Added an optional ajax url parameter to include the current sort per column:
    • Add the {sortList:col} parameter, where col is the actual parameter added to the URL.
    • So this parameter {sortList:sort} with a sortList value of [[2,0],[3,0]] becomes &sort[2]=0&sort[3]=0 in the URL.
    • Thanks to trevorbernard for the enhancement request from issue #155.
  • Fixed an issue with the cssPageSize and cssGoto not becoming disabled when multiple elements exist. Fixes issue #157.

Version 2.4.4 (10/15/2012)

  • Updated pager plugin:
    • Added pagerInitialized event which is triggered after the pager has completed initialization.
    • Added pageMoved event which may fire before the pagerComplete event when ajax processing is involved, or after the pagerComplete on normal use. See issue #153.

Version 2.4.2 (10/17/2012)

  • Ajax loaded tables will no longer hide pages other than the first. Fixes issue #151.
  • Ajax header data now properly replaces the header text.
  • The error message row is now added with the class name from the selectorRemove option.

Version 2.4 (8/19/2012)

  • The pager plugin now plays nice with the filter widget. Fixes issue #6.
  • Added cssGoto option which contains a jQuery selector pointing to a page select dropdown. Updated the pager demo with an example.
  • Updated pager addon to now work with the filter and advanced filter widgets.
  • Added {filteredRows} and {filteredPages} parameters to the output option. They contain the number of rows and pages that result from the filter widget search.

Version 2.2.1 (5/4/2012)

  • Widgets should now apply properly while the pager is active. Fix for issue #60.

Version 2.1.20 (4/28/2012)

  • Optimized pager table rebuilding to also use document fragments, and by removing two extra calls that reapplied the current widgets.

Version 2.1.6 (3/22/2012)

  • Updated pager css. It wasn't targeting the pager block correctly.
  • Moved pager into the thead and/or tfoot in the pager ajax demo.
  • The pager plugin ajax method should now only target the header column text (not the pager) and first footer row when updating the header text.

Version 2.1.3.1 (3/17/2012)

  • Rozwell contributed some bug fixes that occur when cssPageSize is not set. Thanks for sharing!

Version 2.1 (3/8/2012)

  • Ajax:
    • The pager plugin will now interact with a database via JSON. See demo here.

    • Added ajaxUrl option which contains the variables {page} and {size} which will be replaced by the plugin to obtain that data.

      ajaxUrl : "http:/mydatabase.com?page={page}&size={size}"
    • Another option named ajaxProcessing was included to process the data before returning it to the pager plugin. Basically the JSON needs to contain the data to match the example below. An additional required variable is the total number of records or rows needs to be returned.

      // process ajax so that the data object is returned along with the total number of rows
      // example: { "data" : [{ "ID": 1, "Name": "Foo", "Last": "Bar" }], "total_rows" : 100 }
      ajaxProcessing: function(ajax){
        if (ajax && ajax.hasOwnProperty('data')) {
          // return [ "data", "total_rows" ];
          return [ ajax.data, ajax.total_rows ];
        }
      }
    • I tried to make the plugin interact with a database as flexible as possible, but I'm sure I haven't covered every situation. So any and all feedback is welcome!

    • Also, much thanks to kachar for the enhancement request and willingness to help test it!

  • Removed positionFixed and offset options.
  • Added fixedHeight option which replaces the positionFixed and offset options.
    • If true, it should maintain the height of the table, even when viewing fewer than the set number of records (go to the last page to see this in action).
    • It works by adding an empty row to make up the differences in height.
    • There were some issues of the height being incorrect when this option is true. The problems occurred if you add/remove rows + change pager size, or just destroy/enable the pager. I think I fixed it, but if you should find a problem, please report the issue and steps on how to duplicate it.
  • The pager container option will now accept class names. So you can add multiple container blocks to control the pager, just as this page now has two, one above and one below.
  • The pager now adds all of its options to the table configuration options within an object named "pager". Basically what this means is that instead of add all of the pager options to be mixed in with the tablesorter options, the pager options have been isolated and can be found by typing this into the browser console: $('table')[0].config.pager.

Version 2.0.22 (2011-10-13)

  • Updated the pager plugin:
    • Fixed a problem that occurred when removeRows is set to false - fix for issue #4.

    • Added "disable.pager" and "enable.pager" methods to the pager. These are useful if you want to delete a table row with the pager applied.

      ```javascript
      // Delete a row
      // this function targets a button with a "remove" class name inside a table row
      // *************
      // Use delegate or live because `removeRows` is set to `true` in the demo - hidden rows don't exist
      $('table').delegate('button.remove', 'click' ,function(){
        var t = $('table');
        // disabling the pager will restore all table rows
        t.trigger('disable.pager');
        // remove the chosen row
        $(this).closest('tr').remove();
        // restore pager
        t.trigger('enable.pager');
      });
      ```
      
    • Fixed the positionFixed option (which positions the pager below the table) to now include the offset option value.

    • Fixed the pager arrow buttons so that destroying and enabling the pager multiple times doesn't multiply the number of pages changed.

    • Updated the pager demo page to allow deleting rows.

    • General cleanup and added lots of comments in the plugin and demo page on what each pager option does.

  • Made one minor change to the tablesorter plugin to accomidate the pager plugin using the removeRows option.

Version 2.0.22 (2011-10-13)

  • Added "disable.pager" and "enable.pager" methods added to make it easier to add or delete rows from the table.

Version 2.0.16 (2011-09-08)

  • Reduced the number of rows in the demo from 1022 to 50, so you don't have to scroll forever (when the pager is destroyed) to see the code below the table.
  • Added "destroy.pager" method will reveal the entire table, remove the pager functionality, and hide the actual pager.
  • Added a new addRows method to allow adding new rows while the pager is applied to a table. Using "update" would remove all non-visible rows.

Version 2.0.9 (2011-07-27)

  • Pager plugin updates:
    • Removed the separator option and added an output option which allows you to completely customize the output string.
    • In the output string, include any of the following variables:
      • {page} is replaced with the current page number.
      • {totalPages} is replaced with the total number of pages.
      • {startRow} is replaced with the number of the visible start row of the pager.
      • {endRow} is replaced with the number of the visible end row of the pager.
      • {totalRows} is replaced with the total number of rows.
    • The cssPageDisplay option can now target any element; in previous versions, this element was an input of type text.
    • Added a pagerArrows and cssDisabled options:
      • When pagerArrows is true, the first and previous pager arrows have the css class name contained in the cssDisabled option applied when the first row is visible.
      • The next and last pager arrows will be have the cssDisabled class applied when the last row is visible.
      • Additionally, if the number of table rows is less than the pager size, the pager will get the cssDisabled class name applied.
      • If false (the default setting), the pager arrows class names will not change.
      • Please see the updated pager demo to see this working.

Version 2.0.7 (2011-07-17)

  • Added "pagerChange" and "pagerComplete" events in version 2.0.7.