diff --git a/docs/index.html b/docs/index.html index e67270cc..6fdf5594 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2970,6 +2970,10 @@ $.extend($.tablesorter.themes.jui, { Set this option to include a url template to use so that the pager plugin can interact with your database (v2.1; v2.9).

+ The tags within the ajaxUrl string are optional. If do not want the user to change the page size, then you only need to include the page in this string: +
ajaxUrl: "http://mydatabase.com?start={page}"
+ If you need to send your server a page offset (actual starting record number), then you'll need to use the customAjaxUrl option.
+
Here is an example of how to include the option, it should always be paired with an ajaxProcessing function:
$(function(){
   $("table")
@@ -3035,7 +3039,26 @@ $.extend($.tablesorter.themes.jui, {
         return url += '&currntUrl=' + window.location.href;
       }
     });
-});
+}); + In the following example, lets say your server needs a starting and ending record number instead of a page & size parameter. Use this option as follows: +
$(function(){
+  $("table")
+    .tablesorter()
+    .tablesorterPager({
+      ajaxUrl: "http://mydatabase.com?{sortList:col}",
+      customAjaxUrl: function(table, url) {
+        var pager = table.config.pager,
+          start = pager.page * pager.size,
+          end = start + pager.size;
+        return url += '&start=' + start + '&end=' + end;
+      },
+      ajaxProcessing: function(data, table, xhr){
+        // do something with the ajax data
+        return [ total_rows, data ];
+      }
+    });
+});
+ Example @@ -3050,6 +3073,8 @@ $.extend($.tablesorter.themes.jui, {
The ajaxObject is completely customizable, except for the `url` setting which is processed using the pager's `ajaxUrl` and `customAjaxUrl` options.

+ Your server does not need to return a JSON format, if you want to return pure HTML, set the dataType to "html" and modify the ajaxProcessing function to instead work with HTML; then return a jQuery object or apply the HTML to the table yourself.
+
See all possible settings in the jQuery.ajax documentation
$(function(){
   $("table")
@@ -3089,6 +3114,10 @@ $.extend($.tablesorter.themes.jui, {
 					This function is required to return the ajax data obtained from your server into a useable format for tablesorter to apply to the table (v2.1, v2.14.3).
 					

+ This function was created and modified to allow you a great deal of flexibility. The only required information that this function needs to return is an array containing the total number of rows, which is needed to calculate total pages.
+
+ There are numerous examples below. Choosing which one to use is left to you. For more information, please check out related questions on Stackoverflow, in particular see this thread about how to use the different ajax options together.
+
In v2.10, the returned rows is now optional. And it can either be an array of arrays or a jQuery object (not attached to the table)
Process your ajax data so that the following information is returned: