dataTables bottstrap issues with pagination
dataTables bottstrap issues with pagination
djomla
Posts: 3Questions: 0Answers: 0
I copied example from site too test how it works etc. But i'm having issues with pagination.
It's not working.
http://invision.hr/dataTables/tables.html
Here is the live example.
And here is my php implementation
[code]
$columns_num = 5;
$offset = (empty($_GET['iDisplayStart'])) ? 0 : $_GET['iDisplayStart'];
$limit = (empty($_GET['iDisplayLength'])) ? 10 : $_GET['iDisplayLength'];
$show_total = 200;
$return_data = array();
function getrandomstring($length) {
global $template;
settype($template, "string");
$template = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* this line can include numbers or not */
settype($length, "integer");
settype($rndstring, "string");
settype($a, "integer");
settype($b, "integer");
for ($a = 0; $a <= $length; $a++) {
$b = rand(0, strlen($template) - 1);
$rndstring .= $template[$b];
}
return $rndstring;
}
for ($i = $offset; $i <= ($offset+$limit); $i++) {
$data = array();
$data[] = $i;
for ($a = 1; $a < $columns_num; $a++) {
$data[] = getrandomstring(6);
}
$return_data['aaData'][] = $data;
}
$return_data["sEcho"] = 1;
$return_data["iTotalRecords"] = $show_total;
$return_data["iTotalDisplayRecords"] = $show_total;
echo json_encode($return_data);exit;
[/code]
I'm just sending random data in array...it's straightforward just for this test.
What am i doing wrong?
It's not working.
http://invision.hr/dataTables/tables.html
Here is the live example.
And here is my php implementation
[code]
$columns_num = 5;
$offset = (empty($_GET['iDisplayStart'])) ? 0 : $_GET['iDisplayStart'];
$limit = (empty($_GET['iDisplayLength'])) ? 10 : $_GET['iDisplayLength'];
$show_total = 200;
$return_data = array();
function getrandomstring($length) {
global $template;
settype($template, "string");
$template = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* this line can include numbers or not */
settype($length, "integer");
settype($rndstring, "string");
settype($a, "integer");
settype($b, "integer");
for ($a = 0; $a <= $length; $a++) {
$b = rand(0, strlen($template) - 1);
$rndstring .= $template[$b];
}
return $rndstring;
}
for ($i = $offset; $i <= ($offset+$limit); $i++) {
$data = array();
$data[] = $i;
for ($a = 1; $a < $columns_num; $a++) {
$data[] = getrandomstring(6);
}
$return_data['aaData'][] = $data;
}
$return_data["sEcho"] = 1;
$return_data["iTotalRecords"] = $show_total;
$return_data["iTotalDisplayRecords"] = $show_total;
echo json_encode($return_data);exit;
[/code]
I'm just sending random data in array...it's straightforward just for this test.
What am i doing wrong?
This discussion has been closed.
Replies
> An unaltered copy of sEcho sent from the client side. This parameter will change with each draw
Your server-side script is always returning 1.
Allan
Yes now it works! Thank you very much. I just think that it should be more clear about the 'sEcho' because 'unaltered' seems really unclear for me an confusing.
Thank you.