.nodeName == "TR" not working with LiftWeb Framework + Firefox (IE8 works)
.nodeName == "TR" not working with LiftWeb Framework + Firefox (IE8 works)
blankenhorn
Posts: 6Questions: 0Answers: 0
Hi,
first of all thanks for this great kind of plugin.
Environment:
Firefox 3.6.x / IE 8
jQuery 1.4.2
jQueryUI 1.8
DataTables 1.6.2
We tried using dataTables in a project based on the liftweb framework (http://liftweb.net/)
Lift renders everything in xml, so we struggle on dataTable Code like this with Firefox and Opera (Ie8 strangely works) : The reason should be declared in the first paragraph of this blog post: http://ejohn.org/blog/nodename-case-sensitivity/
[code]nNode.nodeName == "TR"[/code]
To get it working i manually added sth. like this in 9 occurances of jquery.datatable.js
[code]( nNode.nodeName == "TR" || nNode.nodeName == "tr")[/code].
Is there any possibility to see sth. like this in a future release of dataTables?
Thanks
Jan
first of all thanks for this great kind of plugin.
Environment:
Firefox 3.6.x / IE 8
jQuery 1.4.2
jQueryUI 1.8
DataTables 1.6.2
We tried using dataTables in a project based on the liftweb framework (http://liftweb.net/)
Lift renders everything in xml, so we struggle on dataTable Code like this with Firefox and Opera (Ie8 strangely works) : The reason should be declared in the first paragraph of this blog post: http://ejohn.org/blog/nodename-case-sensitivity/
[code]nNode.nodeName == "TR"[/code]
To get it working i manually added sth. like this in 9 occurances of jquery.datatable.js
[code]( nNode.nodeName == "TR" || nNode.nodeName == "tr")[/code].
Is there any possibility to see sth. like this in a future release of dataTables?
Thanks
Jan
This discussion has been closed.
Replies
Environment:
Firefox 3.0.19
jQuery 1.4.2
jQueryUI 1.8
DataTables 1.6.2
How to reproduce:
HTML part:
[code]
[/code]
Table preparation:
[code]
$('#test_grid').dataTable({
bJQueryUI: true,
bPaginate: false,
bInfo: false,
aaData: [['1', '2', '3', '4']],
aoColumns: [
{
sTitle: 'Some Title',
sType: 'string',
sClass: 'column',
sWidth: '100%'},
{
sTitle: 'Other',
sType: 'string',
sClass: 'column align-center nowrap',
sWidth: '0%'},
{
sTitle: 'Another Title',
sType: 'string',
sClass: 'column align-center nowrap',
sWidth: '0%'},
{
sTitle: 'Another One',
sType: 'string',
sClass: 'column align-center nowrap',
sWidth: '0%'}]});
[/code]
CSS, but should be irrelevant to the problem:
[code]
.grid .column.align-right {
text-align: right;
}
.grid .column.align-center {
text-align: center;
}
.grid .column.nowrap {
white-space: nowrap;
}
[/code]
Symptom:
The $('#test_grid').dataTable(...) call crashes at line 3633:
[code]
if ( nTds[i].className.indexOf(sClass+"1") != -1 )
[/code]
with the following error:
nTds[i] is undefined
This exceptions is directly caused by the following variable value:
[code]
nTds = [undefined, undefined, undefined, undefined]
[/code]
After tracking back the issue using Firebug I found the following problem:
Line 4437:
[code]
if ( nTd.nodeName == "TD" )
[/code]
But nTd.nodeName == 'td' here, since the table cells are generated by DOM manipulation.
There seem to be many other similar instances of this issue in DataTable, both with "TD" and "TH", other tags might also be affected.
Excellent point! I had no idea that XML documents would retain the original case, but thinking about it now it most certainly makes sense! Yes absolutely I will include this in future versions of DataTables. I'm working on 1.7 just now, so this would be an ideal time to do it :-)
I'll profile how fast (or not) a regex check will be, since that can case insensitive match - allowing for Tr and tR (although the second one is a but 'unusual')!
Regards,
Allan
thanks a lot. I really enjoy working with datatables !!!
Looking forward to see this in 1.7.
Regards Jan
I'm using dataTables version 1.7.5, but this issue is not resolved yet. I have the same issue:
nTds[i] is undefined
http://192.168.x.x/js/jquery.dataTables.js
Line 4681
Could you help me?
Best Regards,
Allan
nTds[i] is undefined
http://192.168.x.x/js/jquery.dataTables.js
Line 4681
Regards,
Mehri
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables
@import "./css/demo_page.css";
@import "./css/demo_table_jui.css";
@import "./css/custom-theme/jquery-ui-1.8.7.custom.css";
var oTable;
var gaiSelected = [];
$(document).ready(function() {
$('#form').submit( function() {
alert (gaiSelected);
return false;
} );
/* Init the table */
oTable = $("#example").dataTable({
"bJQueryUI": true,
"sScrollY": 300,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://192.168.x.x/data.php",
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( jQuery.inArray(aData[0], gaiSelected) != -1 )
{
$(nRow).addClass('row_selected');
}
return nRow;
},
"aoColumns": [
{ "bVisible": 0 }, /* ID column */
null,
null,
null,
null,
null
]
});
/* Click event handler */
$('#example tbody tr').live('click', function () {
var aData = oTable.fnGetData( this );
var iId = aData[0];
if ( jQuery.inArray(iId, gaiSelected) == -1 )
{
gaiSelected[gaiSelected.length++] = iId;
}
else
{
gaiSelected = jQuery.grep(gaiSelected, function(value) {
return value != iId;
} );
}
$(this).toggleClass('row_selected');
} );
} );
Id.
Username
email
First Name
Last Name
Loading data from server
Id.
Username
email
First Name
Last Name
[/code]
Allan
I have 5 columns, but in the javascript code it was 6.
Thanks
Regards,