@josys64 - You've only got two items in the array being returned. DataTables is asking for item three from it (you've for 6 columns) and thus you get the error.
Now while adding new row... am facing the below error
"DataTables warning(table id ='table'): Requested unknown parameter 'FirstColumn' from the data source for row 0"...
[quote] Help me Allan, I've got this warning :
DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0
[/quote]
$(document).ready( function () {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers"
} );
} );
[/code]
[code]
Perhitungan Seleksi Surat Lamaran Kerja
No
Nama Pelamar
<?php
$query = mysql_query("SELECT * FROM kriteria");
while($data = mysql_fetch_assoc($query)){
?>
<?=$data['nmKriteria']?>
<?php }?>
Jumlah
Status
<?php
$no=1;
if($_GET['pilih'] !=''){
$query = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%' ");
}
else $query = mysql_query("SELECT * FROM pelamar ");
while($data = mysql_fetch_assoc($query)){
echo ''.$no++.'';
}
?>
<?php
if($_GET['pilih'] !=''){
$query = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $query = mysql_query("SELECT * FROM pelamar ");
while($data = mysql_fetch_assoc($query)){
echo ''.$data['nmPelamar'].'';
$idPelamar = $data['idPelamar'];
echo '';
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['sertifikat'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesA[] = number_format($hasil['nilai'],3,'.','');
$a= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
}
echo '';
}
?>
<?php
$sex = mysql_query("SELECT * FROM umur LIMIT 1");
$hil = mysql_fetch_array($sex);
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT *,(YEAR(CURDATE())-YEAR(tglLahir)) AS usia FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT *,(YEAR(CURDATE())-YEAR(tglLahir)) AS usia FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['usia'];
echo '';
if ($d >=$hil['min'] and $d<=$hil['max'] ){
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia3'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
else if ($d >=$hil['max']){
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia2'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
else {
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia1'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
echo '';
$tesB[] = number_format($hasil['nilai'],3,'.','');
$b= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['pglmnKerja'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesC[] = number_format($hasil['nilai'],3,'.','');
$c= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
}
echo '';
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['pendidikan'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesD[] = number_format($hasil['nilai'],3,'.','');
$d= number_format($hasil['nilai'],3,'.','');
?>
I was getting this error : and here is a gotcha to be aware of.
If you are pipelining data (using the example function given) ,
and you open a descriptive row using fnOpen() - and leave it open..
Then try to load new table data - you will get this error.
You must remember to clear the pipeline cache before the new Load.
Reset : datatabels_pipeline_Cache={iCacheLower:-1};
Doh!
I was even destroying and recreating the DataTable (in preparation for a new dataset)
Closing the rows prior to the load will help... but it is not the correct solution. (for obvious reasons)
I would guess... somewhere in the pipeline cache it mis-aligns the data structure as set in aoColumnDefs ( I didn't have the time to investigate, just to find the problem and fix it)
(sorry Allan :- "Please link to a test case as noted in the forum rules" .... : way way too complicated and the gotcha is easier to explain :-) )
Hellow, really glad i found this discussion. i am getting a similar error in my DataTables. Though my error is Requested unkown parameter "0" in the row "0". This happens only when my tables have no values at all. Please anyone with the idea of how to fix this.
Replies
Allan
debug link
[code] http://debug.datatables.net/ikuzoz [/code]
[code]
$(document).ready(function(){
$('#example').dataTable({
"bRetrieve":true,
"bJQueryUI":true,
"sPaginationType" : "full_numbers"
});
});
[/code]
[code]
ID User
Username
Nama
Alamat
No HP
Level
Action
<?php
while ($data = mysql_fetch_array ($query))
{
echo "
$data[id_user]
$data[username]
$data[nama]
$data[alamat]
$data[no_hp]
$data[level]
EDIT
|
Delete
";
}
?>
[/code]
please help me
Allan
Below is my code
First Column
Second Column
Third
Action
oTable = $('#table').dataTable({
"bServerSide": false,
"bProcessing": true,
"sAjaxSource": "@Url.Action("Test", "controller")",
"bDestroy": true,
"aoColumns": [
{ "mDataProp": "FirstColumn" },
{ "mDataProp": "SecondColumn" },
{ "mDataProp": "ThirdColumn" },
{
"mData": null,
"bSearchable": false,
"sWidth": '250px',
"bSortable": false,
"fnRender": function(oObj) {
return 'Edit;
},
"mDataProp": null
}
]
});
Now while adding new row... am facing the below error
"DataTables warning(table id ='table'): Requested unknown parameter 'FirstColumn' from the data source for row 0"...
Please help me...
DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0
[/quote]
[code]
@import "../css/demo_page.css";
@import "../css/demo_table_jui.css";
@import "../css/jquery-ui-1.8.4.custom.css";
@import "../css/TableTools_JUI.css";
$(document).ready( function () {
$('#example').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers"
} );
} );
[/code]
[code]
Perhitungan Seleksi Surat Lamaran Kerja
No
Nama Pelamar
<?php
$query = mysql_query("SELECT * FROM kriteria");
while($data = mysql_fetch_assoc($query)){
?>
<?=$data['nmKriteria']?>
<?php }?>
Jumlah
Status
[/code]
<?php
$no=1;
if($_GET['pilih'] !=''){
$query = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%' ");
}
else $query = mysql_query("SELECT * FROM pelamar ");
while($data = mysql_fetch_assoc($query)){
echo ''.$no++.'';
}
?>
<?php
if($_GET['pilih'] !=''){
$query = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $query = mysql_query("SELECT * FROM pelamar ");
while($data = mysql_fetch_assoc($query)){
echo ''.$data['nmPelamar'].'';
$idPelamar = $data['idPelamar'];
echo '';
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['sertifikat'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesA[] = number_format($hasil['nilai'],3,'.','');
$a= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
}
echo '';
}
?>
<?php
$sex = mysql_query("SELECT * FROM umur LIMIT 1");
$hil = mysql_fetch_array($sex);
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT *,(YEAR(CURDATE())-YEAR(tglLahir)) AS usia FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT *,(YEAR(CURDATE())-YEAR(tglLahir)) AS usia FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['usia'];
echo '';
if ($d >=$hil['min'] and $d<=$hil['max'] ){
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia3'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
else if ($d >=$hil['max']){
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia2'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
else {
$qu = mysql_query("SELECT (sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria AND sk.idSk='Usia1'");
$hasil = mysql_fetch_assoc($qu);
echo number_format($hasil['nilai'],3,'.','');
}
echo '';
$tesB[] = number_format($hasil['nilai'],3,'.','');
$b= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['pglmnKerja'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesC[] = number_format($hasil['nilai'],3,'.','');
$c= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
}
echo '';
}
?>
<?php
if($_GET['pilih'] !=''){
$q = mysql_query("SELECT * FROM pelamar WHERE idPosisi LIKE '%$_GET[pilih]%'");
}
else $q = mysql_query("SELECT * FROM pelamar ");
while($dd = mysql_fetch_assoc($q)){
$d = $dd['pendidikan'];
echo '';
$qu = mysql_query("SELECT sk.nmSk,(sk.bobotNilai*k.bobotNilai) as nilai
FROM subkriteria as sk, kriteria as k
WHERE k.idKriteria=sk.idKriteria");
while($hasil = mysql_fetch_assoc($qu)){
$z = $hasil['nmSk'];
if ($d == $z){
echo number_format($hasil['nilai'],3,'.','');
$tesD[] = number_format($hasil['nilai'],3,'.','');
$d= number_format($hasil['nilai'],3,'.','');
?>
<?php
}
}
echo '';
}
?>
<?php
$nx = 0;
$max = 0;
foreach($tesA as $d) {
echo '';
$jumlah = $d+$tesB[$nx]+$tesC[$nx]+$tesD[$nx];
$baca = number_format($jumlah,'3','.','');
echo $baca;
$bc[] = $baca;
if ($baca > $max){
$max = $baca;
}
echo '';
$nx++;
?>
<?php
}
?>
<?php
foreach($bc as $p) {
echo '';
if ($p == $max){
echo 'wawancara';
?>
<?php
}else{
echo 'gagal';
?>
<?php
}
echo '';
}
?>
<?php
if (isset($_POST['simpan'])) {
$nx = 0;
foreach($_POST['idPelamar'] as $d ) {
if ($bc[$nx] == $max){
$query="INSERT INTO seleksi (idPelamar, sertifikat,usia,pglmnKerja,pendidikan,jumlah,status) VALUES ('$d', $tesA[$nx],$tesB[$nx],$tesC[$nx],$tesD[$nx],$bc[$nx],'$_POST[w]') ";
}else{
$query="INSERT INTO seleksi (idPelamar, sertifikat,usia,pglmnKerja,pendidikan,jumlah,status) VALUES ('$d', $tesA[$nx],$tesB[$nx],$tesC[$nx],$tesD[$nx],$bc[$nx],'$_POST[g]') ";
}
$hasil=mysql_query($query);
if ($hasil) {
echo "";
}
else {
echo "koneksi gagal";
}
$nx++;
}
}
?>
[/code]
If you are pipelining data (using the example function given) ,
and you open a descriptive row using fnOpen() - and leave it open..
Then try to load new table data - you will get this error.
You must remember to clear the pipeline cache before the new Load.
Reset : datatabels_pipeline_Cache={iCacheLower:-1};
Doh!
I was even destroying and recreating the DataTable (in preparation for a new dataset)
Closing the rows prior to the load will help... but it is not the correct solution. (for obvious reasons)
I would guess... somewhere in the pipeline cache it mis-aligns the data structure as set in aoColumnDefs ( I didn't have the time to investigate, just to find the problem and fix it)
(sorry Allan :- "Please link to a test case as noted in the forum rules" .... : way way too complicated and the gotcha is easier to explain :-) )
Allan
Reg Number
Tag ID
Owner
Phone Number
Email
Time
Location
Speed
Actions
<?php
$this->load->model('vehicles');
$data = $this->vehicles->get_follow_ups($this->session->userdata('user_id'));
foreach( (isset($data)) ? $data : '' as $d):
$overspeeding = 100;
$speed = (isset($d['vehicle_speed']))? $d['vehicle_speed'] : '';
$veh_no = (isset($d['reg_no']))? $d['reg_no'] : '';
$veh_tag = (isset($d['tag_id']))? $d['tag_id'] : '';
$ownr = (isset($d['owner']))? $d['owner'] : '';
$ownr_phn = (isset($d['owners_phone']))? $d['owners_phone'] : '';
$ownr_email = (isset($d['owners_email']))? $d['owners_email'] : '';
$veh_time = (isset($d['captured_time']))? $d['captured_time'] : '';
$veh_loc = (isset($d['vehicle_location']))? $d['vehicle_location'] : '';
$officer_id = $this->session->userdata('user_id');
$url = site_url('dashboard/table_actions')."?user_id=".$officer_id."&®ist_no=".$veh_no."&&tag_id=".$veh_tag
."&&owner=".$ownr."&&phone=".$ownr_phn."&&email=".$ownr_email."&&time=".$veh_time
."&&location=".$veh_loc."&&speed=".$speed."&&page="."overview"."&&action=remove";
$url2 = site_url('dashboard/table_actions')."?user_id=".$officer_id."&®ist_no=".$veh_no."&&tag_id=".$veh_tag
."&&owner=".$ownr."&&phone=".$ownr_phn."&&email=".$ownr_email."&&time=".$veh_time
."&&location=".$veh_loc."&&speed=".$speed."&&page="."overview"."&&action=captured";
$url3 = site_url('dashboard/table_actions')."?user_id=".$officer_id."&®ist_no=".$veh_no."&&tag_id=".$veh_tag
."&&owner=".$ownr."&&phone=".$ownr_phn."&&email=".$ownr_email."&&time=".$veh_time
."&&location=".$veh_loc."&&speed=".$speed."&&page="."overview"."&&action=search";
$redback = "";
if ($overspeeding <= $speed)
{
$redback = "";
}
echo "".$veh_no."";
echo "".$veh_tag."";
echo "".$ownr."";
echo "".$ownr_phn."";
echo " ".$ownr_email.""."";
echo "".$veh_time."";
echo "".$veh_loc."";
echo "".$redback.$speed."Km/h".""."";
echo "
  
  
  
";
echo "";
endforeach;
?>
[/code]
M getting same error <<<datatables warning (table id = 'example') requested unknown parameter>>>
Can anyone help Me please ???
Here is My code
<
div id="tableDiv" class="body">
<
table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
<thead style="background-color: #E8E8E8;">
<tr>
<!-- <th><input type="checkbox" id="toggle-checkboxes" value="option2" /></th> -->
<th width="10%">User Name</th>
<th width="20%">Action Name</th>
<th width="20%">Action Event</th>
<th width="35%">Action Description</th>
<th width="10%">Action Time</th>
<th width="5%">Action Status</th>
</tr>
</thead>
<tbody> </tbody>
var table = $("#example").dataTable({
M getting same error <<<datatables warning (table id = 'example') requested unknown parameter>>>
Can anyone help Me please ???
Here is My code
<
div id="tableDiv" class="body">
<
table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
<thead style="background-color: #E8E8E8;">
<tr>
<!-- <th><input type="checkbox" id="toggle-checkboxes" value="option2" /></th> -->
<th width="10%">User Name</th>
<th width="20%">Action Name</th>
<th width="20%">Action Event</th>
<th width="35%">Action Description</th>
<th width="10%">Action Time</th>
<th width="5%">Action Status</th>
</tr>
</thead>
<tbody> </tbody>
var table = $("#example").dataTable({
Hi. I get a following error: table id=newsTable - Requested unknown parameter '0' for row 0.
My code:
Javascript:
HTML:
I return a 2D array with aaData array of correct data in 7 columns.
I tried adding this to "aoColumnDefs"
When I add that the error is not there but there are also no data in the table.
I don't know what I am doing wrong. Any help would be highly appreciated! Thanks!
Correction - I get an array of objects in aaData array. Could that be the problem? Thanks.
If you get objects back, you need to tell DataTables. See the data page in the manual.
Allan
Allan thanks for your reply. I solved the issue with