You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in that PHP file i´m using standard MySql and PHP, like this.
filename.php
/* ----------------------------------------------------------------------------------------------------------------------------------- /
$SQL = "SELECT.............."
$result = mysql_query($SQL);
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_object($result)) {
it all goes well except from the fact that it only displays one record - the very first one.
The pagination is fine. it calculates the page numbers just fine.
What is going on ? What am i doing wrong ?.
Can you help me please ?
This is the javascript code i use on the index page.
index.php
/* ----------------------------------------------------------------------------------------------------------------------------------- /
function pageselectCallback(page_index, jq){
var new_content = $("#hiddenresult div.result:eq("+page_index+")").clone();
$("#Searchresult").empty().append(new_content);
return false;
}
function initPagination() {
var num_entries = $("#hiddenresult div.result").length;
$("#Pagination").pagination(num_entries, {
num_edge_entries: 1,
num_display_entries: 7,
callback: pageselectCallback,
items_per_page: 4,
current_page: 0,
next_text: "Próximo",
next_show_always: false,
prev_text: "Anterior",
prev_show_always: true,
ellipse_text: "...",
load_first_page: true,
show_if_single_page:false
});
}
$(document).ready(function(){
$('#hiddenresult').load('filename.php',null,initPagination);
});
/ ----------------------------------------------------------------------------------------------------------------------------------- */
The text was updated successfully, but these errors were encountered:
It is not a Pagination bug. Your callback handler is wrong. With jquery.eq(n) you get just one item from your results, but you need N items (N=items_per_page).
I wrote a small gist with the correct callback. I just removed the external call and added some local data.
Hi,
I´m having an issue with this (great by the way) plugin.
I´m calling a PHP file in the load method, like this:
$('#hiddenresult').load('filename.php',null,initPagination);
in that PHP file i´m using standard MySql and PHP, like this.
filename.php
/* ----------------------------------------------------------------------------------------------------------------------------------- /
$SQL = "SELECT.............."
$result = mysql_query($SQL);
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_object($result)) {
// my items
}
}
/ ----------------------------------------------------------------------------------------------------------------------------------- */
it all goes well except from the fact that it only displays one record - the very first one.
The pagination is fine. it calculates the page numbers just fine.
What is going on ? What am i doing wrong ?.
Can you help me please ?
This is the javascript code i use on the index page.
index.php
/* ----------------------------------------------------------------------------------------------------------------------------------- /
function pageselectCallback(page_index, jq){
var new_content = $("#hiddenresult div.result:eq("+page_index+")").clone();
$("#Searchresult").empty().append(new_content);
return false;
}
function initPagination() {
var num_entries = $("#hiddenresult div.result").length;
$("#Pagination").pagination(num_entries, {
num_edge_entries: 1,
num_display_entries: 7,
callback: pageselectCallback,
items_per_page: 4,
current_page: 0,
next_text: "Próximo",
next_show_always: false,
prev_text: "Anterior",
prev_show_always: true,
ellipse_text: "...",
load_first_page: true,
show_if_single_page:false
});
}
$(document).ready(function(){
$('#hiddenresult').load('filename.php',null,initPagination);
});
/ ----------------------------------------------------------------------------------------------------------------------------------- */
The text was updated successfully, but these errors were encountered: