Skip to content

Commit

Permalink
Merge pull request #256 from Cthulhu59/master
Browse files Browse the repository at this point in the history
Add parameters to ajx url
  • Loading branch information
Mottie committed Mar 28, 2013
2 parents ba885c4 + 6fbce2b commit 6fde718
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions addons/pager/jquery.tablesorter.pager.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
ajaxUrl: null,

customAjaxUrl: function(table, url) { return url; },


// process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
// example:
Expand Down Expand Up @@ -272,12 +275,17 @@
},

getAjaxUrl = function(table, c) {
var url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '',
var url = (c.ajaxUrl) ? c.ajaxUrl.replace(/\{page\}/g, c.page).replace(/\{size\}/g, c.size) : '',
sl = table.config.sortList,
fl = c.currentFilters || [],
sortCol = url.match(/\{sortList[\s+]?:[\s+]?([^}]*)\}/),
filterCol = url.match(/\{filterList[\s+]?:[\s+]?([^}]*)\}/),
arry = [];

if ( typeof(c.customAjaxUrl) === "function" ) {
url = c.customAjaxUrl(table, url);
}

if (sortCol) {
sortCol = sortCol[1];
$.each(sl, function(i,v){
Expand Down Expand Up @@ -577,4 +585,4 @@ $.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});

})(jQuery);
})(jQuery);

0 comments on commit 6fde718

Please sign in to comment.