Pager: a pagerComplete event now fires off immediately after initialization

This commit is contained in:
Mottie 2014-10-30 21:04:53 -05:00
parent 9a3078c33b
commit 340b39a638
3 changed files with 13 additions and 5 deletions

View File

@ -479,7 +479,8 @@
p.initialized = true; p.initialized = true;
$(table) $(table)
.trigger('applyWidgets') .trigger('applyWidgets')
.trigger('pagerInitialized', p); .trigger('pagerInitialized', p)
.trigger('pagerComplete', p);
} }
}, },
@ -946,7 +947,6 @@
$t.trigger('pagerBeforeInitialized', p); $t.trigger('pagerBeforeInitialized', p);
enablePager(table, p, false); enablePager(table, p, false);
if ( typeof(p.ajaxUrl) === 'string' ) { if ( typeof(p.ajaxUrl) === 'string' ) {
// ajax pager; interact with database // ajax pager; interact with database
p.ajax = true; p.ajax = true;
@ -964,8 +964,11 @@
// pager initialized // pager initialized
if (!p.ajax) { if (!p.ajax) {
p.initialized = true; p.initialized = true;
moveToPage(table, p);
updatePageDisplay(table, p, true); updatePageDisplay(table, p, true);
$(table).trigger('pagerInitialized', p); $(table)
.trigger('pagerInitialized', p)
.trigger('pagerComplete', p);
} }
}); });
}; };

View File

@ -4833,8 +4833,11 @@ $('table').trigger( 'search', [['', '', '', '', 'orange']] ); // find orange in
<tr id="pagercomplete"> <tr id="pagercomplete">
<td><a href="#" class="permalink">pagerComplete</a></td> <td><a href="#" class="permalink">pagerComplete</a></td>
<td>This event fires when the pager plugin has completed its render of the table on the currently selected page. (v2.0.7). <td>This event fires when the pager plugin has completed initialization (<span class="version">v2.18.1</span>), and its render of the table on the currently selected page. (v2.0.7).
<div class="collapsible"> <div class="collapsible">
<br>
<span class="label label-info">Note</span> In <span class="version">v2.18.1</span>, the "pagerComplete" event also fires off immediately after pager initialization.<br>
<br>
<pre class="prettyprint lang-js">$(function(){ <pre class="prettyprint lang-js">$(function(){
// initialize the sorter // initialize the sorter

View File

@ -210,7 +210,9 @@ tsp = ts.pager = {
// pager initialized // pager initialized
p.initialized = true; p.initialized = true;
p.isInitializing = false; p.isInitializing = false;
c.$table.trigger('pagerInitialized', c); c.$table
.trigger('pagerInitialized', c)
.trigger('pagerComplete', c);
tsp.updatePageDisplay(table, c); tsp.updatePageDisplay(table, c);
}, },