Requested unknown parameter '0' for row 0, column 0.
Requested unknown parameter '0' for row 0, column 0.

I'm using DataTables and Editor and am getting this dialog popup:
"DataTables warning: table id=ImmigrationNotes - Requested unknown parameter '0' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4"
And when I click to make it go away, the table shows up with the correct number of records yet, there is no text in any of the fields.
No colspan or rowspan in the tbody. The number of columns are equal in the header and table body and are what's in the HTML.
What more can cause the warning? and Why does the correct number of rows show up but no text in any cell?
Replies
Hi Victor,
Yep, definitely not the most actionable error message!
To progress this, would you be able to provide some more information please, such as some DataTables debugging and any code snippets that you are able to share.
Cheers,
Colin
That page provides the diagnostic steps necessary to identify the error.
Thank you for pointing me to DataTables debugging! It pointed out that I needed to update some versions however, I still get the error: Requested unknown parameter '0' for row 0, column 0.
The data is actually correct in the debug yet the data does not show in the page but the records do.
Here is the debugging.
http://debug.datatables.net/afeduh
CSHTML
EDIT: Reformatted code using Markdown.
CONTROLLER
using System.Web;
using System.Web.Http;
using System.Data.SqlClient;
using System.Web.Configuration;
using DataTables;
using school_MVC.Models;
namespace school_MVC.Controllers
{
public class StudentImmigrationNotesDTController : ApiController
{
// GET: Student Immigration Note Info
[HttpGet, HttpPost, Route("api/StudentImmigrationNotes")]
public IHttpActionResult StudentImmigrationNotes()
{
var request = HttpContext.Current.Request;
var sqlType = oluko_MVC.Variables.strOlukoSQLType;
SqlConnection connectionSQL = new SqlConnection(WebConfigurationManager.ConnectionStrings["olukoDataTablesSQLConnection"].ConnectionString);
}
MODEL
using DataTables;
namespace school.Models
{
public class StudentImmigrationNotesModel
{
[EditorTypeError("Immigration Note ID is Required INT")]
[EditorHttpName("Immigration Note ID")]
public int imnImmigrationNoteID { get; set; }
[EditorTypeError("Student ID is required GUID")]
[EditorHttpName("Student ID")]
public System.Guid imnStudentUserID { get; set; }
[EditorTypeError("School ID is required GUID")]
[EditorHttpName("School ID")]
public System.Guid imnSchoolMasterID { get; set; }
[EditorTypeError("Date Student was Advised is Required")]
[EditorHttpName("Advised Date")]
public System.DateTime imnAdvisingDate { get; set; }
[EditorTypeError("Advising Action Given")]
[EditorHttpName("Advising Action Given")]
public string imnAdvisingAction { get; set; }
[EditorTypeError("Advise Type")]
[EditorHttpName("Advise Type")]
public string imnAdvisingType { get; set; }
[EditorTypeError("Advise Notes")]
[EditorHttpName("Advise Notes")]
public string imnAdvisingNote { get; set; }
[EditorTypeError("Advise Source")]
[EditorHttpName("Advise Source")]
public string imnAdvisingSource { get; set; }
}
}
The problem is you are returning an array of objects:
But you haven't used
columns.data
to define the objects. Without this config Datatables is expecting an array containing arrays. More info can be found here:https://datatables.net/manual/data/#Data-source-types
Kevin
Thank you for helping figure out the issue.
I am a new developer and am lost... I went through the examples given for columns.data and the link for Data-source-types and still cannot get it to work.
What is it I need to add and where do I need to add it?
Thanks for that, Kevin, that's a good spot.
Victor, please take a look at https://datatables.net/manual/data/#Objects. As Kevin said, you need to define columns.data - the example on that page is
so you would just slot your column definitions into your code. Hope that helps, if not, please get back in touch.
And a Merry Christmas to all if we don't speak before!
Cheers,
Colin
Okay, got it to work! Thank you all for helping!
It's a bit different though than the example given in how I got it to work... I couldn't use
data: data,
because it gave error data not defined.
So, I tinkered a bit and commented out the data: data line and it worked!
Here's what worked (note the commented out //data: data):
} );
now I have an Editor question I'll put in a different thread.
Merry Christmas to everyone!
Is in the example because the example is essentially showing assigning the object data to a variable
data
. Since you are using an ajax request you don't want to usedata: data
.Kevin
Kevin, that would be helpful stated/shown in the examples because that's what got me confused... though I'm easily confused sometimes!
Thank you for your help!
I'm not sure how to mark this issue as answered so it can be closed?
Noted - I'll add a little comment about that in the documentation. Thanks for the feedback.
Allan
ayuda no puedo cargar datos de un controlador este el código
/////////////////
[HttpPost]
public JsonResult tablaPedidos()
{
y la petición es esta
me sale ese tipo de error cómo puedo solucionarlo?
@Eduardo_Brv I would suggest following the instruction in the technical note linked to in the error. It looks like you're declaring columns with names like
id
,fecha
, andestatus
- but I'm not seeing those in the controller code.Colin