pager: fix plugin errors

This commit is contained in:
Mottie 2014-01-06 19:10:07 -06:00
parent c00f540457
commit 5527bab1c0
2 changed files with 25 additions and 10 deletions

View File

@ -296,7 +296,11 @@
tds += '</tr>';
}
// add rows to first tbody
p.processAjaxOnInit ? c.$tbodies.eq(0).html( tds ) : p.processAjaxOnInit = true;
if (p.processAjaxOnInit) {
c.$tbodies.eq(0).html( tds );
} else {
p.processAjaxOnInit = true;
}
}
// only add new header text if the length matches
if ( th && th.length === hl ) {
@ -336,7 +340,7 @@
fixHeight(table, p);
// apply widgets after table has rendered
$t.trigger('applyWidgets');
$t.trigger('updateRow', [false, function(){
$t.trigger('updateRows', [false, function(){
if (p.initialized) {
$t.trigger('updateComplete');
$t.trigger('pagerChange', p);
@ -559,19 +563,26 @@
},
enablePager = function(table, p, triggered){
var pg = p.$size.removeClass(p.cssDisabled).removeAttr('disabled');
p.$goto.removeClass(p.cssDisabled).removeAttr('disabled');
var info,
c = table.config;
p.$size.add(p.$goto).removeClass(p.cssDisabled).removeAttr('disabled').attr('aria-disabled', 'false');
p.isDisabled = false;
p.page = $.data(table, 'pagerLastPage') || p.page || 0;
p.size = $.data(table, 'pagerLastSize') || parseInt(pg.find('option[selected]').val(), 10) || p.size || 10;
pg.val(p.size); // set page size
p.$size.val(p.size); // set page size
p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );
// if table id exists, include page display with aria info
if ( table.id ) {
info = table.id + '_pager_info';
p.$container.find(p.cssPageDisplay).attr('id', info);
c.$table.attr('aria-describedby', info);
}
if ( triggered ) {
$(table).trigger('updateRow');
c.$table.trigger('updateRows');
setPageSize(table, p.size, p);
hideRowsSetup(table, p);
fixHeight(table, p);
if (table.config.debug) {
if (c.debug) {
ts.log('pager enabled');
}
}

View File

@ -479,7 +479,11 @@ tsp = ts.pager = {
tds += '</tr>';
}
// add rows to first tbody
wo.pager_processAjaxOnInit ? c.$tbodies.eq(0).html( tds ) : wo.pager_processAjaxOnInit = true;
if (wo.pager_processAjaxOnInit) {
c.$tbodies.eq(0).html( tds );
} else {
wo.pager_processAjaxOnInit = true;
}
}
// only add new header text if the length matches
if ( th && th.length === hl ) {
@ -519,7 +523,7 @@ tsp = ts.pager = {
tsp.fixHeight(table, c);
// apply widgets after table has rendered
$t.trigger('applyWidgets');
$t.trigger('updateRow', [false, function(){
$t.trigger('updateRows', [false, function(){
if (p.initialized) {
$t.trigger('updateComplete');
$t.trigger('pagerChange', c);
@ -762,7 +766,7 @@ tsp = ts.pager = {
p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );
c.$table.removeClass('pagerDisabled');
if ( triggered ) {
c.$table.trigger('updateRow');
c.$table.trigger('updateRows');
tsp.setPageSize(table, p.size, c);
tsp.hideRowsSetup(table, c);
tsp.fixHeight(table, c);