$prevStart = false;
$nextStart = false;
$start = 1;
- $limit = 20; // Set to the number of listings per page
+ $limit = 10; // Set to the number of listings per page
$namesList = false;
$enable_members = $this->config['settings']['enable_members'];
$textSearch = false;
// Check if we're doing paging
if (isset($_REQUEST['pageSelect'])) {
-
+
// If request is for Next
- if ($_REQUEST['pageSelect'][0] == 'N') {
+ if (trim($_REQUEST['pageSelect'])[0] == 'N') {
$newStart = $_REQUEST['nextStart'] - 0;
- // $this->write_log("\nNEW START:". $newStart);
// Otherwise it must be Previous
} else {
$newStart = $_REQUEST['prevStart'] - 0;
$support->write_log($where);
// Get a current list of members
$listResult = $this->getSimpleMembersList($where.$alphaWhere, 'name', true, 'id', $start, $limit);
- $support->write_log($listResult );
+ //$support->write_log($listResult );
// Get paging results
$numbDisplayed = $listResult['returned'];
$lastDisplayed = $listResult['last'];
}
if ($listResult['returned'] == $limit) {
$nextStart = $start + $limit;
- // $this->write_log("\nYOP");
+
+ }
+ if ($nextStart > $memberCount) {
+ $nextStart = false;
}
+
+ //$this->write_log("\nYOP". $memberCount . " mcL: " . $nextStart);
// $this->write_log("\nstart: " . $start);
// $this->write_log("\nlimit: " . $limit);
// $this->write_log("\nNext start: " . $nextStart);
<div class="glm-admin-pagination-buttons">
- <span class="pagination button button-secondary previous-button glm-button prev-start-button {if !$prevStart}disabled{/if}"{if !$prevStart} disabled{/if}>Previous {$limit} {$terms.term_member_plur_cap}</span>
- <span class="pagination button button-secondary next-button glm-button next-start-button {if !$nextStart}disabled{/if}"{if !$nextStart} disabled{/if}>Next {$limit} {$terms.term_member_plur_cap}</span>
+ <span class="pagination button button-secondary previous-button glm-button prev-start-button {if !$prevStart}disabled{/if}">
+ Previous {$limit} {$terms.term_member_plur_cap}
+ </span>
+ <span class="pagination button button-secondary next-button glm-button next-start-button {if !$nextStart}disabled{/if}">
+ Next {$limit} {$terms.term_member_plur_cap}
+ </span>
</div>
\ No newline at end of file
// console.log( $("#nextStart").attr("nextStart"));
$(document).on("click", ".pagination", function(e){
- if (!$(this).attr("disabled")) {
+ if (!$(this).hasClass("disabled")) {
listData.pageSelect = $(this).text();
listData.prevStart = $("#pagination-data").attr("data-prevStart");
listData.nextStart = $("#pagination-data").attr("data-nextStart");
$("#glm-admin-search-overlay").fadeOut('slow'),
function(data) {
$("#member-results-container").html(data.searchData);
- console.log(data.searchData);
var newPrevStart = $("#pagination-data").attr("data-prevStart");
- console.log("Newprevstart: " + newPrevStart);
- if (newPrevStart) {
- $(".pagination.previous-button").removeAttr("disabled");
- } else {
- $(".pagination.previous-button").attr("disabled", "disabled");
- }
+ $(".pagination.previous-button").toggleClass("disabled", newPrevStart);
var newNextStart = $("#pagination-data").attr("data-nextStart");
- console.log("Newnextstart: " + newNextStart);
- if (newNextStart) {
- $(".pagination.next-button").removeAttr("disabled");
- } else {
- $(".pagination.next-button").attr("disabled", "disabled");
- }
+ $(".pagination.next-button").toggleClass("disabled", newNextStart);
},
function(error) {
console.log(error);