diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index 78071cab..55dcbdf2 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -327,8 +327,12 @@ tsp = ts.pager = { }) // {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object) .replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){ - var t = m.replace(/[{}\s]/g,''), a = t.split(':'), d = p.ajaxData; - return a.length > 1 && d && d[a[0]] ? d[a[0]][a[1]] : p[t] || (d ? d[t] : '') || ''; + var str = m.replace(/[{}\s]/g,''), + extra = str.split(':'), + data = p.ajaxData, + // return zero for default page/row numbers + deflt = /(rows?|pages?)$/i.test(str) ? 0 : ''; + return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt; }); if (out.length) { out[ (out[0].tagName === 'INPUT') ? 'val' : 'html' ](s);