Pager: clear tbody prior to calling ajaxProcessing

This commit is contained in:
Rob Garrison 2015-11-09 11:42:42 -06:00
parent 00daa3d148
commit 08735db313
5 changed files with 16 additions and 10 deletions

View File

@ -385,6 +385,12 @@
renderAjax = function(data, table, p, xhr, settings, exception){
// process data
if ( typeof p.ajaxProcessing === 'function' ) {
// in case nothing is returned by ajax, empty out the table; see #1032
// but do it before calling pager_ajaxProcessing because that function may add content
// directly to the table
c.$tbodies.eq(0).empty();
// ajaxProcessing result: [ total, rows, headers ]
var i, j, t, hsh, $f, $sh, $headers, $h, icon, th, d, l, rr_count, len,
c = table.config,
@ -444,9 +450,6 @@
if (p.processAjaxOnInit) {
c.$tbodies.eq(0).html( tds );
}
} else {
// nothing returned by ajax, empty out the table; see #1032
c.$tbodies.eq(0).empty();
}
p.processAjaxOnInit = true;
// only add new header text if the length matches

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -485,9 +485,9 @@
<br><br>
</li>
<li>Pager plugin (<a href="example-pager.html">basic</a> &amp; <a href="example-pager-ajax.html">ajax</a> demos; <span class="version updated">v2.24.0</span>).</li>
<li>Pager plugin (<a href="example-pager.html">basic</a> &amp; <a href="example-pager-ajax.html">ajax</a> demos; <span class="version updated">v2.24.4</span>).</li>
<li>
Pager widget (<a href="example-widget-pager.html">basic</a> &amp; <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.24.0</span>).<br>
Pager widget (<a href="example-widget-pager.html">basic</a> &amp; <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.24.4</span>).<br>
<br>
</li>

View File

@ -654,6 +654,12 @@
wo = c.widgetOptions;
// process data
if ( $.isFunction(wo.pager_ajaxProcessing) ) {
// in case nothing is returned by ajax, empty out the table; see #1032
// but do it before calling pager_ajaxProcessing because that function may add content
// directly to the table
c.$tbodies.eq(0).empty();
// ajaxProcessing result: [ total, rows, headers ]
var i, j, t, hsh, $f, $sh, $headers, $h, icon, th, d, l, rr_count, len,
$table = c.$table,
@ -712,9 +718,6 @@
if (wo.pager_processAjaxOnInit) {
c.$tbodies.eq(0).html( tds );
}
} else {
// nothing returned by ajax, empty out the table; see #1032
c.$tbodies.eq(0).empty();
}
wo.pager_processAjaxOnInit = true;
// only add new header text if the length matches