Skip to content

Commit 0ddbafd

Browse files
committed
Fixed issue where pagination total number of pages was based on the full location set total instead of the storeLimit setting
1 parent 88700cf commit 0ddbafd

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

dist/assets/js/plugins/storeLocator/jquery.storelocator.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! jQuery Google Maps Store Locator - v2.6.2 - 2016-07-16
1+
/*! jQuery Google Maps Store Locator - v2.6.2 - 2016-07-19
22
* http://www.bjornblog.com/web/jquery-store-locator-plugin
33
* Copyright (c) 2016 Bjorn Holine; Licensed MIT */
44

@@ -869,9 +869,16 @@
869869
paginationSetup: function (currentPage) {
870870
this.writeDebug('paginationSetup',arguments);
871871
var pagesOutput = '';
872-
var totalPages = locationset.length / this.settings.locationsPerPage;
872+
var totalPages;
873873
var $paginationList = $('.bh-sl-pagination-container .bh-sl-pagination');
874874

875+
// Total pages
876+
if ( this.settings.storeLimit === -1 || locationset.length < this.settings.storeLimit ) {
877+
totalPages = locationset.length / this.settings.locationsPerPage;
878+
} else {
879+
totalPages = this.settings.storeLimit / this.settings.locationsPerPage;
880+
}
881+
875882
// Current page check
876883
if (typeof currentPage === 'undefined') {
877884
currentPage = 0;
@@ -2377,8 +2384,8 @@
23772384
});
23782385

23792386
// Add the list li background colors - this wil be dropped in a future version in favor of CSS
2380-
$('.' + _this.settings.locationList + ' ul li:even').css('background', _this.settings.listColor1);
2381-
$('.' + _this.settings.locationList + ' ul li:odd').css('background', _this.settings.listColor2);
2387+
$('.' + _this.settings.locationList + ' ul > li:even').css('background', _this.settings.listColor1);
2388+
$('.' + _this.settings.locationList + ' ul > li:odd').css('background', _this.settings.listColor2);
23822389

23832390
// Visible markers list
23842391
if(_this.settings.visibleMarkersList === true) {

dist/assets/js/plugins/storeLocator/jquery.storelocator.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ filtering.
3636
## Changelog
3737

3838
### Version 2.6.2
39+
3940
* Added callbackMapSet callback that fires after the map has been set up.
40-
* Fixed issue where locations without attributes could get those attribute values from prior locations.
41+
* Fixed issue where locations without attributes set could get the attribute values from prior locations.
42+
* Fixed issue where pagination total number of pages was based on the full location set total instead of the storeLimit setting.
4143
* Removed form markup from initial query string example index file as it's not needed until the submission page.
4244

4345
### Version 2.6.1

src/js/jquery.storelocator.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,16 @@
866866
paginationSetup: function (currentPage) {
867867
this.writeDebug('paginationSetup',arguments);
868868
var pagesOutput = '';
869-
var totalPages = locationset.length / this.settings.locationsPerPage;
869+
var totalPages;
870870
var $paginationList = $('.bh-sl-pagination-container .bh-sl-pagination');
871871

872+
// Total pages
873+
if ( this.settings.storeLimit === -1 || locationset.length < this.settings.storeLimit ) {
874+
totalPages = locationset.length / this.settings.locationsPerPage;
875+
} else {
876+
totalPages = this.settings.storeLimit / this.settings.locationsPerPage;
877+
}
878+
872879
// Current page check
873880
if (typeof currentPage === 'undefined') {
874881
currentPage = 0;
@@ -2374,8 +2381,8 @@
23742381
});
23752382

23762383
// Add the list li background colors - this wil be dropped in a future version in favor of CSS
2377-
$('.' + _this.settings.locationList + ' ul li:even').css('background', _this.settings.listColor1);
2378-
$('.' + _this.settings.locationList + ' ul li:odd').css('background', _this.settings.listColor2);
2384+
$('.' + _this.settings.locationList + ' ul > li:even').css('background', _this.settings.listColor1);
2385+
$('.' + _this.settings.locationList + ' ul > li:odd').css('background', _this.settings.listColor2);
23792386

23802387
// Visible markers list
23812388
if(_this.settings.visibleMarkersList === true) {

0 commit comments

Comments
 (0)