Jump to content

Bug & fix: blocklayered removing pagination


Recommended Posts

We're running presta 1.6.11.

 

We ran into a problem of the bottom pagination being removed when a second page in the pagination was visited.

 

In blocklayered.js various parts of the page are filled with new data upon completing the ajax request for the next page in pagination.

We found out that the HTML used by the code, around line 500 of blocklayered.js, to replace the second aka bottom pagination is empty, thus causing the pagination to be removed.

 

This is because jQuery objects, into which this HTML was put for calculation purposes by presta, cannot be inserted twice.

The jQuery object used here is confusingly called 'data'.

So a copy of this jQuery object was required for the insertation.

 

The following function returns a jQuery clone of any jQuery object.

 

            function jqclone($el){
                return $el.clone();
            }

Using this around line 530 solved the problem.

                if (data.find('ul.pagination').length)
                {

                    $('div.pagination').show();
                    $('ul.pagination').each(function () {
                    $(this).replaceWith(data.find('ul.pagination'));
                    });
                }

became

                if (data.find('ul.pagination').length)
                {

                    $('div.pagination').show();
                    $('ul.pagination').each(function () {
                    $(this).replaceWith(jqclone(data.find('ul.pagination')));
                    });
                }

Cheers
Sjerp van Wouden
Site by Site

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...