Warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 10
Warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 10
Hi all,
my first attempt at DataTables and perhaps I've jumped in at the deep-end too soon...
I've gotten my table to successfully get the data from a MySQL database using the server_processing.php template and now I'm trying to implement a CRUD version using jeditable.js.
My problem is that when I execute the adddata.php, the data is successfully added but I get the warning: "DataTables warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 10"
If I increase the display to 25 rows then this warning is for row 25.
I've tried following all the recommendations from previous posts but don't seem to be getting anywhere, please help!
I've saved my Debugger output: here: http://debug.datatables.net/iroyis
I'll add a couple of posts showing the webpage etc.
my first attempt at DataTables and perhaps I've jumped in at the deep-end too soon...
I've gotten my table to successfully get the data from a MySQL database using the server_processing.php template and now I'm trying to implement a CRUD version using jeditable.js.
My problem is that when I execute the adddata.php, the data is successfully added but I get the warning: "DataTables warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 10"
If I increase the display to 25 rows then this warning is for row 25.
I've tried following all the recommendations from previous posts but don't seem to be getting anywhere, please help!
I've saved my Debugger output: here: http://debug.datatables.net/iroyis
I'll add a couple of posts showing the webpage etc.
This discussion has been closed.
Replies
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<?php
$title='Dings Database Admin - View Players';
include('adm_inc_lnktitle.php');
?>
<?php include('adm_inc_header.php'); ?>
<?php include('adm_inc_navigation.php'); ?>
Last name
First name
Date of birth
Available?
Year got Cap
Players Table
ID
Last Name
First Name
Date Of Birth
Available?
Got Cap
<?php include('adm_inc_footer.php'); ?>
$(document).ready(function() {
$('#example').dataTable({
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": "scripts/DingsServer_processing.php",
"aoColumns":[
{
"bVisible" : false
}, //playerID is hidden
{sName: "lastnme"
},//lastnme
{sName: "firstnme"
},//firstnme
{sName: "dob"
},//dob
{sName: "avail"
},//avail
{sName: "gotcap"
}//gotcap
]
}).makeEditable({
sUpdateURL: 'scripts/DingsEditable_ajax.php',
sAddURL: "adm_player_add.php",
sDeleteURL: "adm_player_delete.php",
fnOnDeleted: function() {
oTable.fnReloadAjax(true)
},
aoColumns: [
{
},
{
},
{
cssclass: "date"
},
{
type: 'select',
onblur: 'submit',
data: "{'':'Please select...', 'Y':'Y','N':'N'}"
},
{
oValidationOptions : { rules:{ value: {minlength: 4 } },
messages: { value: {minlength: "Enter at least 4 digits"} } }
}
]
});
} );
[/code]
[code] <?php
//adm_player_add.php
// $id = $_REQUEST['id'] ;
$id = 0;
$firstname = $_REQUEST['firstname'];
$lastname = $_REQUEST['lastname'];
$dob = $_REQUEST['dob'];
$avail = $_REQUEST['avail'];
$gotcap = $_REQUEST['gotcap'];
// connect to the database
include('conn.php');
// save the data to the database
mysql_query("INSERT $app_players SET firstnme='$firstname', lastnme='$lastname', dob='$dob', avail='$avail', gotcap='$gotcap'")
or die(mysql_error());
$id = mysql_insert_id();
echo $id;
?>
[/code]
What I would suggest is to modify the editable plug-in to add a console.log of the data that it is trying to add just before fnAddData (actually, given that you are using server-side processing, using fnAddData is completely pointless in this case, it should just skip that and draw the table - you could perhaps modify the source to do that - just call fnDraw() rather than fnAddData...)
Allan
Pete.
Allan
I had this same issue. Calling fnDraw instead of fnAddData solved the issue :). Thank you allan! If you guys had a bigger discussion on this issue, can you include me on that?
Thank you!
Kaushik