Begin to handle pagination.

This lets the initial view display only a single page, future commits
will add in the paginater.
This commit is contained in:
George Stephanis 2015-08-07 16:02:45 -04:00
parent be4c7db8bd
commit d9b2907ae2
1 changed files with 12 additions and 1 deletions

View File

@ -40,8 +40,19 @@
}); });
} }
renderTableContents( data.rates ); /**
* Handle the initial display.
*/
if ( data.rates.length <= data.limit ) {
renderTableContents( data.rates );
} else {
var first_index = data.limit * ( data.page - 1),
last_index = data.limit * data.page;
renderTableContents( data.rates.slice( first_index, last_index ) );
// We've now displayed our initial page, time to render the pagination box.
}
$('.wc_tax_rates .remove_tax_rates').click(function() { $('.wc_tax_rates .remove_tax_rates').click(function() {
if ( $tbody.find('tr.current').length > 0 ) { if ( $tbody.find('tr.current').length > 0 ) {