Skip to content

Commit

Permalink
Add custom ajax url to add custom params to url
Browse files Browse the repository at this point in the history
  • Loading branch information
Cthulhu59 committed Mar 11, 2013
1 parent 82697d9 commit 6fbce2b
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 @@ -571,4 +579,4 @@ $.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});

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

0 comments on commit 6fbce2b

Please sign in to comment.