DataTables warning:added data does not match known number of columns

Source: Internet
Author: User

When you write a program recently, the page uses DataTables to appear with this error message as shown:

It was very strange at the time, because the column values set in the DataTables are as long as the fields of the database query statement, why do you still report such errors? Through IE debugging tools, found that because there is a null value in the record, the database query out of the following records:

2011-05-18 18:31:13,750 Org.apache.ibatis.logging.slf4j.Slf4jImpl:

row:1000100011, 10001fxsp_name_11, <==, NULL, 22.94, 1.8216482164821648

There are only 5 data available from JSON to the foreground page, as shown in figure:

Datatables.js 2603 Line source code in:

/* Sanity Check the length of the new array * *
Modify by Ruiming.lu
if (adatasupplied.length!= oSettings.aoColumns.length &&
if (Adatasupplied.length > OSettings.aoColumns.length &&
Osettings.idrawerror!= Osettings.idraw)
{
_fnlog (osettings, 0, "Added data" (Size "+adatasupplied.length+") does not match known "+
"Number of columns (" +osettings.aocolumns.length+ ")");
Osettings.idrawerror = Osettings.idraw;
return-1;
}

There is such a statement to judge, so this error is thrown.

Therefore, in the use of the process to pay attention to the processing of null values.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.