Colspan and rowspan did not work in IE7
Colspan and rowspan did not work in IE7
I tried complex_header example included in 1.5 beta6. It worked in Firefox, but did not work in IE7. In IE7 the browser will report error:
Line 2051
Char:6
aoColumns[...] could not be null
I tried to add aoColumns definition:
"aoColumns": [{"bSortable": true},{"bSortable": true},{"bSortable": true},{"bSortable": true},{"bSortable": true}]
The warning disappear, but the column header still not sortable.
In Firefox and Google Chrome, everything worked.
Line 2051
Char:6
aoColumns[...] could not be null
I tried to add aoColumns definition:
"aoColumns": [{"bSortable": true},{"bSortable": true},{"bSortable": true},{"bSortable": true},{"bSortable": true}]
The warning disappear, but the column header still not sortable.
In Firefox and Google Chrome, everything worked.
This discussion has been closed.
Replies
Good call - thanks for letting me know about that. Interesting one this one... For columns which don't have a colspan (or rowspan) attribute IE reports the colspan value as 1 (which actually seems reasonable), while all the other browsers report the value as 0, which is what I was switching on.
Easy fix (fortunately!) and I'll release it in 1.5 beta 7, which I think it is about time for. It will be out shortly.
Allan
Good work. It worked now.
And I found the numeric type detection function will detect date format "yyyy-MM-dd" as numeric type because it contains symbol "-", which will make the column not sortable.
I borrowed some code from number plugin and do some quick hack to solve the problem:
jQuery.fn.dataTableExt.oSort['formatted-num-asc'] = function(x, y) {
x = x.replace(/[^\d\-\.\/]/g, '');
y = y.replace(/[^\d\-\.\/]/g, '');
if (x.indexOf('/') >= 0)
x = eval(x);
if (y.indexOf('/') >= 0)
y = eval(y);
return x / 1 - y / 1;
}
jQuery.fn.dataTableExt.oSort['formatted-num-desc'] = function(x, y) {
x = x.replace(/[^\d\-\.\/]/g, '');
y = y.replace(/[^\d\-\.\/]/g, '');
if (x.indexOf('/') >= 0)
x = eval(x);
if (y.indexOf('/') >= 0)
y = eval(y);
return y / 1 - x / 1;
}
jQuery.fn.dataTableExt.aTypes[0] = function(sData) {
var sValidChars = "0123456789.";
var Char;
var bDecimal = false;
sData = sData.replace(/,/g, "");
/* Check the numeric part */
for (i = 0; i < sData.length; i++) {
Char = sData.charAt(i);
if (sValidChars.indexOf(Char) == -1) {
if (Char == '-') {
if (i == 0) {
continue;
} else { // Possible date
return "natural";
}
continue;
} else {
return null;
}
}
if (Char == '.') {
if (bDecimal) {
return null;
}
bDecimal = true;
}
}
return "formatted-num";
}
Can we expect improvement on numeric detection in final release?
Allan