Skip to:
Content

BuddyPress.org

Changeset 7946


Ignore:
Timestamp:
02/21/2014 02:37:15 AM (12 years ago)
Author:
r-a-y
Message:

Fix AJAX pagination when clicked page number is 1000 or more.

Previously, BP's javascript was converting the paginated element
content to a number with the Number() function. This doesn't work
with comma-seperated number strings (eg. 1,000), which returned a NaN
value causing problems during the AJAX callback.

This commit changes the way the page number is parsed in BP's
javascript by grabbing the page number from the 'href' attribute.
Thereby, ensuring that AJAX pagination works for pages greater than
1000.

Fixes #5404

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-templates/bp-legacy/js/buddypress.js

    r7941 r7946  
    748748                                var el = jq('li.filter select');
    749749
    750                         var page_number = 1;
    751750                        var css_id = el.attr('id').split( '-' );
    752751                        var object = css_id[0];
     
    754753                        var pagination_id = jq(target).closest('.pagination-links').attr('id');
    755754
     755                        var page_number = target.attr('href').split( '=' );
     756                        page_number = page_number[1];
     757
    756758                        if ( jq('div.dir-search input').length )
    757759                                search_terms = jq('.dir-search input').val();
    758760
    759                         if ( jq(target).hasClass('next') )
    760                                 var page_number = Number( jq('.pagination span.current').html() ) + 1;
    761                         else if ( jq(target).hasClass('prev') )
    762                                 var page_number = Number( jq('.pagination span.current').html() ) - 1;
    763                         else
    764                                 var page_number = Number( jq(target).html() );
    765                        
    766761                        if ( pagination_id.indexOf( 'pag-bottom' ) !== -1 ) {
    767762                                var caller = 'pag-bottom';
Note: See TracChangeset for help on using the changeset viewer.