Datatable initialisation issue with aoColumnDefs on Internet Explorer 7
Datatable initialisation issue with aoColumnDefs on Internet Explorer 7
Hi,
I use datatable with tables using colspans. I use aoColumnDefs to sort the first column containing numeric values. It works on Firefox, IE8 and higher. But there is a Javascript Error on IE7. I noticed that if I remove the aoColumnDefs option on the datatable, or if I set the option sType to HTML, there is no more Javascript error. The error occures only if there are several rows in the table body. Any help would be useful to fix this problem. Because our customer still use IE7.
Regards,
Xavier
Here is the code for the initialisation :
[code]
var oTable = $("#tabResultsMatrix").dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sZeroRecords": "Nothing found"
},
"aoColumnDefs": [
{ "sType": "numeric", "aTargets": [ 0 ] }
]
});
[/code]
Here is the code for sorting the table :
[code]
$(window).load(function() {
jQuery.fn.dataTableExt.oSort['numeric-asc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['numeric-desc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
});
[/code]
Here is the HTML for the table :
[code]
Features
BBB
M1
M1-1
M1-11
Id
Technology
Domain
Subdomain
FW
Feature
Comments
Reference
FR
State
Test
Roadmap
Scalability
Comment
Actions
853
E1
OAM
Connectivity check
Loopback at E1 level
Validity time before loopback stops
valid
NA/V1R2/DRD/MSA/10-064
Test :
OK
NO
NA
Release :
Choose ...
V1Rx
V1R2
NA/V1R2/DRD/MSA/10-064
Roadmap :
Choose ...
V1Rx
V1R2
Scalability :
E1 not tested on PTN3900
Comment :
Send
Cancel
<!-- And many other rows -->
[/code]
I use datatable with tables using colspans. I use aoColumnDefs to sort the first column containing numeric values. It works on Firefox, IE8 and higher. But there is a Javascript Error on IE7. I noticed that if I remove the aoColumnDefs option on the datatable, or if I set the option sType to HTML, there is no more Javascript error. The error occures only if there are several rows in the table body. Any help would be useful to fix this problem. Because our customer still use IE7.
Regards,
Xavier
Here is the code for the initialisation :
[code]
var oTable = $("#tabResultsMatrix").dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sZeroRecords": "Nothing found"
},
"aoColumnDefs": [
{ "sType": "numeric", "aTargets": [ 0 ] }
]
});
[/code]
Here is the code for sorting the table :
[code]
$(window).load(function() {
jQuery.fn.dataTableExt.oSort['numeric-asc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['numeric-desc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
});
[/code]
Here is the HTML for the table :
[code]
Features
BBB
M1
M1-1
M1-11
Id
Technology
Domain
Subdomain
FW
Feature
Comments
Reference
FR
State
Test
Roadmap
Scalability
Comment
Actions
853
E1
OAM
Connectivity check
Loopback at E1 level
Validity time before loopback stops
valid
NA/V1R2/DRD/MSA/10-064
Test :
OK
NO
NA
Release :
Choose ...
V1Rx
V1R2
NA/V1R2/DRD/MSA/10-064
Roadmap :
Choose ...
V1Rx
V1R2
Scalability :
E1 not tested on PTN3900
Comment :
Send
Cancel
<!-- And many other rows -->
[/code]
This discussion has been closed.
Replies
1) In the first column, I have removed the . There is only a numeric value.
2) I have removed the following extra sort plugin which is not necessary :
[code]$(window).load(function() {
jQuery.fn.dataTableExt.oSort['numeric-asc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['numeric-desc'] = function(a,b) {
x = parseFloat( a );
y = parseFloat( b );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
});[/code]
Now, it works fine in all IE versions