Sorting and paggination

Sorting and paggination

janmjanm Posts: 2Questions: 0Answers: 0
edited November 2013 in General
Hey,

Im totally new to datatables and there is a possibility that my problem is my fault.

I have manage to sent JSON data to my datatables and it works (displaying part).

But i can't sort them or just display 10,25 or 50 of them.
Any ideas?

and my Php and JS code:
PHP
[code]
$users = getAllUsers();
$count = sizeof($users);
$arrayOfUsers =[];
$num = 1;
foreach($users as $curUser){
$arrayOfUsers[]=
array(
0 => $curUser->getFullName(),
1 => $curUser->getMail(),
2 => $curUser->getActivated(),
3 => "x",
"DT_RowId" => "row_".$num,
"DT_RowClass" => "gradeA"
);
$num++;
}
$output = array(
"sEcho" => 1,
"iTotalRecords" => $count,
"iTotalDisplayRecords" => $count,
"aaData" => $arrayOfUsers
);
echo json_encode($output);
?>
[/code]

and JS
[code]
$(document).ready(function() {
$('.datatable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "json.php"
} );
} );
[/code]

Thanks!!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please link to a test case.

    Allan
  • janmjanm Posts: 2Questions: 0Answers: 0
    edited November 2013
    Hy,

    I have already figure it out.
    But thank you anyway.
This discussion has been closed.