testing edit function - getting error message

testing edit function - getting error message

ashiersashiers Posts: 101Questions: 8Answers: 7
edited May 2013 in Editor
Hi there,

I've done a search regarding this error message on your site but I'm spinning my wheels trying to understand it. Error Message: Requested unknown parameter 'LASTNAME' from the data source for row 0. I get this when I click on the EDIT button and after making a small change on one of the fields, regardless of which one, and click on the UPDATE button. A request is sent to the server and it returns a valid JSON string. I'm hoping you can point out the error of my ways. Please advise.

Alan

Following is my code:

HTML:
*******************
[code]




jQuery Example



@import "css/demo_page.css";
@import "css/jquery.dataTables.css";
@import "css/TableTools.css";
@import "css/dataTables.editor.css";

#big_wrapper{
border: 1px solid black;
width:1000px;
margin: 20px auto;
text-align:left;
}







CRUD DataTable Example







LASTNAME
FIRSTNAME
TITLE
EMAIL_ADDRESS





LASTNAME
FIRSTNAME
TITLE
EMAIL_ADDRESS















[/code]
********************************
crud.js:
[code]
var editor; // use a global for the submit and return data rendering in the examples

$(document).ready(function() {

editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "http://localhost:8080/JQuery/data2.jsp",
"domTable": "#employees",
"fields": [ {
"label": "LASTNAME:",
"name": "LASTNAME",
"type": "text"
}, {
"label": "FIRSTNAME:",
"name": "FIRSTNAME",
"type": "text"
}, {
"label": "TITLE:",
"name": "TITLE",
"type": "text"
}, {
"label": "EMAIL_ADDRESS:",
"name": "EMAIL_ADDRESS",
"type": "text"
}
]
} );

$('#employees').dataTable( {
"sDom": "Tfrtip",
"sAjaxSource": "http://localhost:8080/JQuery/data2.jsp",
"aoColumns": [
{ "mData": "LASTNAME" },
{ "mData": "FIRSTNAME" },
{ "mData": "TITLE" },
{ "mData": "EMAIL_ADDRESS" }
],
"oTableTools": {
"sRowSelect": "single",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
} );
} );
[/code]

The post made to the server:

action edit
data[EMAIL_ADDRESS] ladongo@eastlink.ca
data[FIRSTNAME] Louiseee
data[LASTNAME] Adongo
data[TITLE] Janitor
id row_552
table

The returned JSON string:

{"id":"row_552","error":"","fieldErrors":[],"data":[],"row":[{"DT_RowId":"row_552"},{"LASTNAME":"Adongo"},{"FIRSTNAME":"Louiseee"},{"TITLE":"Janitor"},{"EMAIL_ADDRESS":"ladongo@eastlink.ca"}]}

Replies

  • ashiersashiers Posts: 101Questions: 8Answers: 7
    There doesn't seem to be a way to remove a post. So, anyone reading this can disregard this thread as I've discovered the problem. The JSON string itself was incorrectly formatted. I've made the appropriate changes and have everything working properly now. I'll move onto other features and try to learn some more.

    Alan
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Hi Alan,

    Good to hear you have the issue resolved!

    Regards,
    Allan
This discussion has been closed.