DataTables warning (table id = 'My Table'): Requested unknown parameter '0' from the data source
DataTables warning (table id = 'My Table'): Requested unknown parameter '0' from the data source
gbroke
Posts: 7Questions: 0Answers: 0
I know this is a pretty common error, that is generally an issue with the column count. I do have the column column correct, and my javascript array appears to be good. I am stumped.
I used the datatables debugger. Here is my debug info:
http://debug.datatables.net/unefuy
Thank you for any help.
I used the datatables debugger. Here is my debug info:
http://debug.datatables.net/unefuy
Thank you for any help.
This discussion has been closed.
Replies
You need to use mDataProp to tell DataTables what property you want to use from your data source objects. The objects have no inherent order, so there is no way for DataTables to know what property you want to belong in each column unless you specifically tell it.
This blog post has more information about mDataProp: http://datatables.net/blog/Extended_data_source_options_with_DataTables
Allan
mDataProp certainly opens up a huge number of options for DataTables - I'm going to write up a blog post soon about using it as a function to allow orthogonal data to be used for sorting / display / filtering etc...
Allan
I am very new to datatables, but already find it very exciting. I am facing a similar issue - a warning "requested unknown parameter...".
Here is my debug info:
http://debug.datatables.net/esakej
What I am trying to do is to show/hide a particular record of a table, using an example from here: http://datatables.net/release-datatables/examples/api/row_details.html
From the debugger info, I can see that the 'Type' of the first column (which is dynamically created) is not coming through, and can be the issue. But I can't figure out how to tackle that. Am not sure if I need to use mDataProp here and if so, how. Your help is most appreciated!
Thanks.
Thanks for the debug trace. What I think is causing the problem is that:
- You have 6 items being returned from the server, per row
- You have 7 columns in the table
These two need to match, since DataTables is currently looking for data for the 7th column, but it isn't in the data source! If there is no such data, or you want just a static value for the 7th column, you can use sDefaultContent .
Allan
I use the latest script, I have the same pb.
there my code :
DataTables warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 4
[code]
......
@import "ext/javascript/DataTables-1.9.1/media/css/demo_page.css";
@import "ext/javascript/DataTables-1.9.1/media/css/demo_table_jui.css";
$(document).ready(function() {
oTable = $('#example').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"bJQueryUI": true
});
} );
.......
<!-- 13 row below -->
<?php echo TABLE_HEADING_MODEL; ?>
<?php echo TABLE_HEADING_PRODUCTS; ?>
<?php
if (MODE_B2B_B2C == 'true') {
?>
<?php echo TABLE_HEADING_PRODUCTS_GROUP; ?>
<?php
}
?>
<?php echo TABLE_HEADING_PERCENTAGE; ?>
<?php echo TABLE_HEADING_PRODUCTS_PRICE; ?>
<?php echo TABLE_HEADING_SCHEDULED_DATE; ?>
<?php echo TABLE_HEADING_EXPIRES_DATE; ?>
<?php echo TABLE_HEADING_ARCHIVE; ?>
<?php echo TABLE_HEADING_STATUS; ?>
<?php echo TABLE_HEADING_ACTION; ?>
<?php
......
while ($specials = tep_db_fetch_array($specials_query)) {
?>
<!-- 13 row below -->
<?php
if (MODE_B2B_B2C == 'true') {
?>
<?php
}
?>
<?php
} // end while
?>
[/code]
if I insert a new row ( ===> 14 row) in the while condition, The error deseapear. i don't understand i need insert a new row in the while condition.
head of the table : 13 row
data inside the table : 14 row
Thanks
if I insert this in the while condition
[code]
dfgdfg
dfg
dgfd
dfgdfg
dfgdfg
dfgdfg
dgdfgdfg
dgfdg
dfgdfg
dfgdfg
dgfdg
dgdfgdf
[/code]
it work perfect but If I do that
[code]
<?php
if ($specials['selected']) {
?>
<?php
} else {
?>
<?php
}
?>
dfgdfg
dfg
dgfd
dfgdfg
dfgdfg
dfgdfg
dgdfgdfg
dgfdg
dfgdfg
dfgdfg
dgfdg
dgdfgdf
[/code]
the error appear : why ?
head of the table : 13 row
data inside the table : 14 row
[/quote]
That's the problem - they must match exactly, or you will get this error.
In your second post above you are adding an extra column - you've got an if condition around the input element which is fine - but there is still one extra column there.
Allan
[code]
<?php
if ($specials['selected']) {
?>
<?php
} else {
?>
<?php
}
?>
[/code]
The error : DataTables warning (table id = 'example'): Requested unknown parameter '0' from the data source for row 4
If i change by that, the error deseapear
[code]hlkhjkl [/code]
How to resolve that
If you aren't Ajax loading data, don't include sAjaxSource at all. Also DataTables isn't doing the Ajax there - so I'm not sure what is. You'd need to give us a link - see: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
Allan
[code]
{
"mDataProp": null,
"bSortable": false,
"bSearchable": false,
"sWidth": "15px"
}
[/code]
I solved it by changing 'mDataProp' to 'mData' - maybe something in the handling of the deprecation is funky when it comes to null values?
Hopefully that helps.
Correct :-(. It has been fixed in git, but 1.9.4 does indeed suffer from a bug there.
Allan