Difference between ableable1.9 and datatable1.10

Source: Internet
Author: User

I am also exploring the new usage of ableable1.10. If any error occurs in the following code, please submit it ..

1.10 and 1.9 difference official website Description: http://www.datatables.net/upgrade/1.10


Let's look at the code. Let's first look at the 1.9 statement:

$ (Document). Ready (function (){

VaR table, _ qdata;

Table = $ ('# example'). datatable ({
Aocolumns: _ tablecols,
Fncreatedrow: XXXXX, // function name
});
Loadlist ();

});

// table: Table object
function loadlist () {
$. ajax ({
URL: '/queryxx',
data: _ qdata,
datatype: 'json',
success: function (data) {
table. fncleartable ();
table. fnadddata (data. records);
}< BR >});
}

VaR _ tablecols = [{
Mdata: NULL,
Bsortable: false,
Sclass: "center ",
Swidth: "30 ",
Mrender: XXXX // function name
},{
Mdata: 'groupcode ',
Swidth: "120 ",
Bsortable: True
},{
Mdataprop: "UUID ",
Sclass: "center ",
Bsortable: false,
Swidth: "124 ",
Mrender: XXXX // function name
}];


Now let's look at the 1.10 statement.

$ (Document). Ready (function (){

VaR table, _ qdata;

Table = $ ('# example'). datatable ({
"Columns": _ tablecols,
"Createdrow": XXXXX, // function name
});
Loadlist ();

});

// table: Table object
function loadlist () {
$. ajax ({
URL: '/queryxx',
data: _ qdata,
datatype: 'json',
success: function (data) {
table. clear (). draw ();
table. rows. add (data. records ). draw ();
}< BR >});
}

VaR _ tablecols = [{
Data: NULL,
Orderable: false,
Classname: "center ",
Width: "30 ",
Render: XXXX // function name
},{
Data: 'groupcode ',
Width: "120 ",
Orderable: True
},{
Data: "UUID ",
Classname: "center ",
Orderable: false,
Width: "124 ",
Render: XXXX // function name
}];

We are looking at a 1.10 statement. In this case, place Ajax in the datatable.

VaR table = $ ('# example'). datatable ({
"Columns": _ tablecols, // _ tablecols.
Createdrow: XXXXX, // this function is used for row events
"Ajax ":{
"Url": "XXXXX ",
"Type": "Post ",
"Datasrc": function (JSON ){
Return JSON. records;
},
"Error": function (){
VaR DATA = {
"Data": []
};
Return data;
}
},});

This method can also assign values to the datatable ....


The use of mdataprop binding fields is the same as that of mdata, both of which are datatable 1.9 and earlier. Data is used after 1.10.

1.9 ----- "1.10

Mdata mdataprop --> data
Bsortable --> orderable
Sclass --> classname
Swidth --> width
Mrender --> render
Fncreatedrow --> createdrow


Datatables warning table ID requested unknown parameter from the data source for row

(Note: the reason for these warnings are normally due to null values in the data source. The key to suppressing this warning is through the use of the sdefaultcontent property .)

The following code can solve the problem:

1. "aocolumndefs ":[{
Sdefaultcontent :'',
Atargets: ['_ all']
}],

2.

Add$. FN. datatableext. serrmode = 'throw'In the page where the plugin is used

Search datatable 1.10 Ajax






Difference between ableable1.9 and datatable1.10

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.