Getting Requested unknown parameter '0' for row 0 Error in datatables server side
This is a frequently asked question, but I haven't found a solution in the existing threads. It typically points to a mismatch between headers and cells, but I believe that's not the case here. Maybe I'm just looking past it...
My JSON...
{"draw": 1, "recordsTotal": 5, "recordsFiltered": 5, "data": [{"fName":"Ida","lName":"Black"},{"fName":"Gwen","lName":"Sharp"},{"fName":"Sharon","lName":"Sullivan"},{"fName":"Claudette","lName":"Tidwell"},{"fName":"Ellie","lName":"Westman"}]}
My HTML...
<table id="datatable_tabletools" width="100%">
<thead>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</thead>
<tfoot>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</tfoot>
</table>
My JS...
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"data": "../contacts/returnjson"
});
Any ideas on why I'm getting this error?
javascript jquery json datatables
add a comment |
This is a frequently asked question, but I haven't found a solution in the existing threads. It typically points to a mismatch between headers and cells, but I believe that's not the case here. Maybe I'm just looking past it...
My JSON...
{"draw": 1, "recordsTotal": 5, "recordsFiltered": 5, "data": [{"fName":"Ida","lName":"Black"},{"fName":"Gwen","lName":"Sharp"},{"fName":"Sharon","lName":"Sullivan"},{"fName":"Claudette","lName":"Tidwell"},{"fName":"Ellie","lName":"Westman"}]}
My HTML...
<table id="datatable_tabletools" width="100%">
<thead>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</thead>
<tfoot>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</tfoot>
</table>
My JS...
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"data": "../contacts/returnjson"
});
Any ideas on why I'm getting this error?
javascript jquery json datatables
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00
add a comment |
This is a frequently asked question, but I haven't found a solution in the existing threads. It typically points to a mismatch between headers and cells, but I believe that's not the case here. Maybe I'm just looking past it...
My JSON...
{"draw": 1, "recordsTotal": 5, "recordsFiltered": 5, "data": [{"fName":"Ida","lName":"Black"},{"fName":"Gwen","lName":"Sharp"},{"fName":"Sharon","lName":"Sullivan"},{"fName":"Claudette","lName":"Tidwell"},{"fName":"Ellie","lName":"Westman"}]}
My HTML...
<table id="datatable_tabletools" width="100%">
<thead>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</thead>
<tfoot>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</tfoot>
</table>
My JS...
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"data": "../contacts/returnjson"
});
Any ideas on why I'm getting this error?
javascript jquery json datatables
This is a frequently asked question, but I haven't found a solution in the existing threads. It typically points to a mismatch between headers and cells, but I believe that's not the case here. Maybe I'm just looking past it...
My JSON...
{"draw": 1, "recordsTotal": 5, "recordsFiltered": 5, "data": [{"fName":"Ida","lName":"Black"},{"fName":"Gwen","lName":"Sharp"},{"fName":"Sharon","lName":"Sullivan"},{"fName":"Claudette","lName":"Tidwell"},{"fName":"Ellie","lName":"Westman"}]}
My HTML...
<table id="datatable_tabletools" width="100%">
<thead>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</thead>
<tfoot>
<tr>
<th>fName</th>
<th>lName</th>
</tr>
</tfoot>
</table>
My JS...
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"data": "../contacts/returnjson"
});
Any ideas on why I'm getting this error?
javascript jquery json datatables
javascript jquery json datatables
asked Nov 12 '18 at 17:02
tintyethan
1,22221432
1,22221432
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00
add a comment |
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00
add a comment |
1 Answer
1
active
oldest
votes
You need to specify data property names for each column using columns.data
option.
Also you should be using ajax.url
option to define data source URL if you are using Ajax-sourced data.
For example:
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "../contacts/returnjson"
},
"columns": [
{ "data": "fName" },
{ "data": "lName" }
]
});
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266867%2fgetting-requested-unknown-parameter-0-for-row-0-error-in-datatables-server-sid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to specify data property names for each column using columns.data
option.
Also you should be using ajax.url
option to define data source URL if you are using Ajax-sourced data.
For example:
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "../contacts/returnjson"
},
"columns": [
{ "data": "fName" },
{ "data": "lName" }
]
});
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
add a comment |
You need to specify data property names for each column using columns.data
option.
Also you should be using ajax.url
option to define data source URL if you are using Ajax-sourced data.
For example:
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "../contacts/returnjson"
},
"columns": [
{ "data": "fName" },
{ "data": "lName" }
]
});
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
add a comment |
You need to specify data property names for each column using columns.data
option.
Also you should be using ajax.url
option to define data source URL if you are using Ajax-sourced data.
For example:
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "../contacts/returnjson"
},
"columns": [
{ "data": "fName" },
{ "data": "lName" }
]
});
You need to specify data property names for each column using columns.data
option.
Also you should be using ajax.url
option to define data source URL if you are using Ajax-sourced data.
For example:
$('#datatable_tabletools').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "../contacts/returnjson"
},
"columns": [
{ "data": "fName" },
{ "data": "lName" }
]
});
answered Nov 13 '18 at 4:22
Gyrocode.com
36.6k870112
36.6k870112
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
add a comment |
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
perfect. thanks. I don't understand why this isn't in the datatables example, but thanks.
– tintyethan
Nov 13 '18 at 15:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266867%2fgetting-requested-unknown-parameter-0-for-row-0-error-in-datatables-server-sid%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
is it definitely returning the JSON correctly? Check your network tools to see if the file is being downloaded successfully.
– ADyson
Nov 12 '18 at 18:03
I don't see the name of the action in the network tab. Datatables does seem to be aware of the number of rows returned though. Although I specify 5 rows above, I was previously not doing that, and the rows displayed in datatables were correct, but blank and I got the error above.
– tintyethan
Nov 12 '18 at 21:00