[1.7.5] Nested dataTables cause "sData is undefined" error
[1.7.5] Nested dataTables cause "sData is undefined" error
vicaya
Posts: 14Questions: 0Answers: 0
Tried to embed a dataTables in the TDs of another dataTables, it causes 'g is undefined" in jquery.dataTables.min.js and 'sData is undefined' in uncompressed version. EDIT: changed category to "bug reports".
The following is an HTML 4.01 strict (validated) page to demonstrate the problem.
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Test DataTables
$(function() {
$('#t2').dataTable({bJQueryUI:true, sDom:'t',aoColumns:[null, {bSortable:false, bSearchable:false}]}).fnSetFilteringDelay(288);
$('#t3').dataTable({bJQueryUI:true, sDom:'t'}).fnSetFilteringDelay(288);
$('#t4').dataTable({bJQueryUI:true, sDom:'t'}).fnSetFilteringDelay(288);
});
Nested tables
Column1
Column2
r1
SubColumn1
SubColumn2
subc1r1
subc2r1
subc1r2
subc2r2
r2
SubColumn1
SubColumn2
subc1r1
subc2r1
subc1r2
subc2r2
[/code]
The following is an HTML 4.01 strict (validated) page to demonstrate the problem.
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Test DataTables
$(function() {
$('#t2').dataTable({bJQueryUI:true, sDom:'t',aoColumns:[null, {bSortable:false, bSearchable:false}]}).fnSetFilteringDelay(288);
$('#t3').dataTable({bJQueryUI:true, sDom:'t'}).fnSetFilteringDelay(288);
$('#t4').dataTable({bJQueryUI:true, sDom:'t'}).fnSetFilteringDelay(288);
});
Nested tables
Column1
Column2
r1
SubColumn1
SubColumn2
subc1r1
subc2r1
subc1r2
subc2r2
r2
SubColumn1
SubColumn2
subc1r1
subc2r1
subc1r2
subc2r2
[/code]
This discussion has been closed.
Replies
I've got to admit - I'm really surprised that this validates given that there are no closing tags on the table! That's absolutely amazing in fact...
However, the problem comes from this:
[code]
r1
[/code]
DataTables currently doesn't allow TH elements in the TBODY. It will in future, but not yet I'm afraid. If you change that TH to a TD it will work as expected. You can add a class to the new TD element to style it like a TH if you want.
Regards,
Allan
> DataTables currently doesn't allow TH elements in the TBODY.
Anywhere (all descendants) in the TBODY? Because an embedded dataTables needs TH? or is TD in THEAD good enough?
I always write HTML in HTML 4 strict, but with closing tags - I didn't realise you could write a table without closing tags. I like that trick - might be very useful for where the odd byte is important with bandwidth - thanks for the heads up :-)
Allan