Add pager processAjaxOnInit option. Fixes #424

This commit is contained in:
Mottie 2013-12-15 05:07:22 -06:00
parent eb13fb4b14
commit 161c2ad99d
3 changed files with 18 additions and 2 deletions

View File

@ -30,6 +30,9 @@
dataType: 'json'
},
// set this to false if you want to block ajax loading on init
processAjaxOnInit: true,
// process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
// example:
@ -290,7 +293,7 @@
tds += '</tr>';
}
// add rows to first tbody
c.$tbodies.eq(0).html( tds );
p.processAjaxOnInit ? c.$tbodies.eq(0).html( tds ) : p.processAjaxOnInit = true;
}
// only add new header text if the length matches
if ( th && th.length === hl ) {

View File

@ -2754,6 +2754,16 @@ $.extend($.tablesorter.themes.jui, {
<td><a href="example-pager-ajax.html">Example</a></td>
</tr>
<tr id="pager-processajaxoninit">
<td><span class="permalink">processAjaxOnInit</span></td>
<td>Boolean</td>
<td>true</td>
<td>
Set this option to <code>false</code> if your table data is preloaded into the table, but you are still using ajax (<span class="version">v2.14.5</span>).
</td>
<td></td>
</tr>
<tr id="pager-ajaxprocessing">
<td><a href="#" class="permalink">ajaxProcessing</a></td>
<td>Function</td>

View File

@ -54,6 +54,9 @@ ts.addWidget({
dataType: 'json'
},
// set this to false if you want to block ajax loading on init
pager_processAjaxOnInit: true,
// process ajax so that the following information is returned:
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
// example:
@ -476,7 +479,7 @@ tsp = ts.pager = {
tds += '</tr>';
}
// add rows to first tbody
c.$tbodies.eq(0).html( tds );
wo.pager_processAjaxOnInit ? c.$tbodies.eq(0).html( tds ) : wo.pager_processAjaxOnInit = true;
}
// only add new header text if the length matches
if ( th && th.length === hl ) {