Allow for optional output callback in favour of parsable string

This commit is contained in:
Joel Perry 2016-09-09 09:29:50 +01:00
parent daa7cfa89c
commit 44f6a4771f

View File

@ -182,6 +182,11 @@
p.startRow = (t) ? sz * p.page + 1 : (p.filteredRows === 0 ? 0 : sz * p.page + 1);
p.endRow = Math.min( p.filteredRows, p.totalRows, sz * ( p.page + 1 ) );
$out = p.$container.find(p.cssPageDisplay);
// Output param can be callback for custom rendering or string
if (typeof p.output === 'function') {
s = p.output(table, p);
} else {
// form the output string (can now get a new output string from the server)
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || p.output : p.output )
// {page} = one-based index; {page+#} = zero based index +/- value
@ -203,6 +208,7 @@
}
return extra.length > 1 && data && data[extra[0]] ? data[extra[0]][extra[1]] : p[str] || (data ? data[str] : deflt) || deflt;
});
}
if ( p.$goto.length ) {
t = '';
options = buildPageSelect( table, p );