Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82269

testing edit function - getting error message

$
0
0
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:
*******************
<head>
  <meta charset="utf-8">
  <meta http-equiv="cache-control" content="no-cache" />
  <meta http-equiv="pragma" content="no-cache" />
  <title>jQuery Example</title>
  
  <style type="text/css" title="currentStyle">
			
			@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;
            }
  </style>
	

  
</head>
<body id="dt_example">
   <div id="big_wrapper">
   <H1>CRUD DataTable Example</H1>
    
   <div id="demo">
   
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="employees">
	<thead>
		<tr>
		    
			<th width="20%">LASTNAME</th>
			<th width="20%">FIRSTNAME</th>
			<th width="30%">TITLE</th>
			<th width="30%">EMAIL_ADDRESS</th>			
		</tr>
	</thead>
	<tfoot>
		<tr>
		    
			<th>LASTNAME</th>
			<th>FIRSTNAME</th>
			<th>TITLE</th>
			<th>EMAIL_ADDRESS</th>			
		</tr>
	</tfoot>
    </table>
	</div>
    </div>


  
   <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.js"></script>
   <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.dataTables.js"></script>
   <script type="text/javascript" language="javascript" charset="utf-8" src="js/dataTables.tabletools.min.js"></script>
   <script type="text/javascript" language="javascript" charset="utf-8" src="js/dataTables.editor.js"></script>
   <script type="text/javascript" language="javascript" charset="utf-8" src="js/crud.js"></script>
</body>
</html>
********************************
crud.js:
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 }
						]
					}
				} );
			} );

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"}]}

Viewing all articles
Browse latest Browse all 82269

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>