Pager: maintain pageDisplay ID if one exists. Fixes #1288

This commit is contained in:
Rob Garrison 2016-09-22 21:09:18 -05:00
parent 0161acff0a
commit 7e11139496
4 changed files with 21 additions and 11 deletions

View File

@ -871,7 +871,7 @@
},
enablePager = function(table, p, triggered) {
var info, size,
var info, size, $el,
c = table.config;
p.$size.add(p.$goto).add(p.$container.find('.ts-startRow, .ts-page'))
.removeClass(p.cssDisabled)
@ -884,10 +884,15 @@
p.$size.val( p.size ); // set page size
p.totalPages = p.size === 'all' ? 1 : Math.ceil( getTotalPages( table, p ) / 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 ( table.id && !c.$table.attr( 'aria-describedby' ) ) {
$el = p.$container.find( p.cssPageDisplay );
info = $el.attr( 'id' );
if ( !info ) {
// only add pageDisplay id if it doesn't exist - see #1288
info = table.id + '_pager_info';
$el.attr( 'id', info );
}
c.$table.attr( 'aria-describedby', info );
}
changeHeight(table, p);
if ( triggered ) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1205,7 +1205,7 @@
},
enablePager: function( c, triggered ) {
var info, size,
var info, size, $el,
table = c.table,
p = c.pager;
p.isDisabled = false;
@ -1216,9 +1216,14 @@
p.totalPages = p.size === 'all' ? 1 : Math.ceil( tsp.getTotalPages( c, p ) / p.size );
c.$table.removeClass( 'pagerDisabled' );
// if table id exists, include page display with aria info
if ( table.id ) {
info = table.id + '_pager_info';
p.$container.find( c.widgetOptions.pager_selectors.pageDisplay ).attr( 'id', info );
if ( table.id && !c.$table.attr( 'aria-describedby' ) ) {
$el = p.$container.find( c.widgetOptions.pager_selectors.pageDisplay );
info = $el.attr( 'id' );
if ( !info ) {
// only add pageDisplay id if it doesn't exist - see #1288
info = table.id + '_pager_info';
$el.attr( 'id', info );
}
c.$table.attr( 'aria-describedby', info );
}
tsp.changeHeight( c );