DataTables warning: table id=employeeTable - Requested unknown parameter 'lang' for row 0, colum 1
DataTables warning: table id=employeeTable - Requested unknown parameter 'lang' for row 0, colum 1
I am using datatables to fill data into the table in jsp using response from Java.
I randomly keep getting alert message saying 'DataTables warning: table id=employeeTable - Requested unknown parameter 'lang' for row 0, column 1. For more information about this error, please see http://datatables.net/tn/4'.
Data is received from Java backend successfully, but this alert pops up randomly(not all the time).
Below is the code that I am using in jsp to fill data in employeeTable table-
function insertRecInTable(URL) {
var smsUplaodTemplateTable = $("#employeeTable").DataTable({
"bServerSide": true,
"sAjaxSource": URL,
"bProcessing": true,
"sPaginationType": "full_numbers",
"bJQueryUI": false,
"scrollY": "650px",
"scrollX": true,
"scrollCollapse": true,
"fixedColumns": true,
"bAutoWidth": false,
"async": false,
"aoColumns": [
{ "mDataProp": "empId", "sClass": "textCenter" },
{ "mDataProp": "lang", "sClass": "textCenter" },
{ "mDataProp": "content" },
{
"mDataProp": null,
"sClass": "textCenter",
"orderable": false,
"mRender": function(data, type, full) {
return "<button id='showListBtn'>Show List</button>";
}
}
]
});
}
This method works perfectly and fills the data in the table but alert message pops up at some times.
Did I also use "async": false correctly?
I am new to datatables, any help is appreciated.
Answers
Just for reference as this is not the problem. You are using some legacy option names like
aoColumns
which is nowcolumns
. The legacy names are supported. This page shows the conversion from legacy to the current naming convention.Have you followed the troubleshooting steps at the URL in the error?
http://datatables.net/tn/4
The error indicates that your data doesn't always have the
lang
object as part of the row data. If this is expected you can usedefaultContent
to show a default value in that column if the object is not there. If this is not expected then you will need to troubleshoot your server script to find out why the data is missing.Datatables doesn't have an
async
option. If you are trying to make the Ajax request asynchronous then you will need to use theajax
option instead ofsAjaxSource
. However setting async false for Ajax is not recommended. Why do you want to do this?Kevin
Hi kthorngren, I changed the legacy option names and tried to run the code, now it is not working at all.
And the 'lang' object in always fetched from the query and the response is always available from java to jsp.
I also tried troubleshooting steps from the URL in the error but that did not help.
Here is my code after changing legacy option names.
The reason for putting 'async' was that I thought that UI table is getting displayed before getting the response from Java and hence causing the alert sometimes.
You have server-side processing enabled - does whatever
URL
points to fully implement server-side processing?If you link to the page we'll be able to diagnose the issue and they you know what is causing it.
Allan
Hi Allan,
URL is pointing to Java class which in turn calls Rest API to fetch data from the DB to display in the table
Thanks - however, I'm afraid that doesn't answer my question. Does that REST API implement server-side processing? If not, remove that option.
As I say, if you give me a link to the page I'll be able to help more. Otherwise, and without more information, I'm really just guessing.
Allan