Server-side script does not show results in view

Server-side script does not show results in view

aditronaditron Posts: 1Questions: 0Answers: 0
edited March 2010 in General
Apologies if this one has already been answered, but after a few hours of gong through the forums I've not been able to resolve this one...

I'm using the server-processing method as described here: http://www.datatables.net/examples/server_side/server_side.html

My problem is that I constantly receive the following error: "DataTables warning: Added data does not match known number of columns". Once I clear the JS pop-up errors my table collapses from the ten records shown to none (or "No matching records found").

My jquery code is:
[code]
$('#members_view').dataTable( {
"bStateSave": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "admin/modules/members/actions/server_processing.php",
"aoColumns": [
{ "sName": "username" },
{ "sName": "firstName" },
{ "sName": "lastName" },
{ "sName": "signupDate" },
{ "sName": "top1score" },
{ "sName": "top2score" },
{ "sName": "top3score" },
{ "sName": "top4score" },
{ "sName": "top5score" },
{ "sName": "top6score" },
{ "sName": "totalScore" },
null,
null
]

} );
} );
[/code]
The HTML this falls into is:
[code]



Username
First name
Last name
Date joined
Game 1 score
Game 2 score
Game 3 score
Game 4 score
Game 5 score
Game 6 score
Total score
Make winner
Update Password



<?
// random PHP data populating script
?>


<?=@$username?>
<?=@$firstName?>
<?=@$lastName?>
<?=@$signupDate?>
<?=@$top1score?>
<?=@$top2score?>
<?=@$top3score?>
<?=@$top4score?>
<?=@$top5score?>
<?=@$top6score?>
<?=@$totalScore?>
<? echo _ICON_ADD; ?>
<? echo _ICON_EDIT; ?>

<?
}
?>


[/code]

Both my PHP/HTML and the jQuery spit out 13 columns - yet I cannot seem to avoid this error.
I'm using dataTables 1.6.1

Any help would be greatly appreciated!

Replies

  • emjay2emjay2 Posts: 10Questions: 0Answers: 0
    if you are using server-side processing, you shouldnt be populating the query. the server side processing script should just pass back JSON to populate the stubbed table.
This discussion has been closed.